2020-11-14 22:10:11 +01:00
|
|
|
# Stage 0:
|
|
|
|
# Build the assets that are needed for the frontend. This build stage is then discarded
|
|
|
|
# since we won't need NodeJS anymore in the future. This Docker image ships a final production
|
|
|
|
# level distribution of Pterodactyl.
|
2021-12-04 19:33:42 +01:00
|
|
|
FROM --platform=$TARGETOS/$TARGETARCH mhart/alpine-node:14
|
2018-05-18 04:53:17 +02:00
|
|
|
WORKDIR /app
|
|
|
|
COPY . ./
|
2020-11-14 22:10:11 +01:00
|
|
|
RUN yarn install --frozen-lockfile \
|
|
|
|
&& yarn run build:production
|
2018-05-18 04:53:17 +02:00
|
|
|
|
2020-11-14 22:10:11 +01:00
|
|
|
# Stage 1:
|
|
|
|
# Build the actual container with all of the needed PHP dependencies that will run the application.
|
2021-12-04 19:33:42 +01:00
|
|
|
FROM --platform=$TARGETOS/$TARGETARCH php:7.4-fpm-alpine
|
2020-11-14 22:10:11 +01:00
|
|
|
WORKDIR /app
|
|
|
|
COPY . ./
|
|
|
|
COPY --from=0 /app/public/assets ./public/assets
|
|
|
|
RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar unzip nginx libpng-dev libxml2-dev libzip-dev certbot \
|
|
|
|
&& docker-php-ext-configure zip \
|
|
|
|
&& docker-php-ext-install bcmath gd pdo_mysql zip \
|
|
|
|
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
|
|
|
|
&& cp .env.example .env \
|
2020-11-14 22:26:43 +01:00
|
|
|
&& mkdir -p bootstrap/cache/ storage/logs storage/framework/sessions storage/framework/views storage/framework/cache \
|
2020-11-14 22:10:11 +01:00
|
|
|
&& chmod 777 -R bootstrap storage \
|
|
|
|
&& composer install --no-dev --optimize-autoloader \
|
2020-11-14 22:26:43 +01:00
|
|
|
&& rm -rf .env bootstrap/cache/*.php \
|
2020-11-14 22:10:11 +01:00
|
|
|
&& chown -R nginx:nginx .
|
|
|
|
|
2021-08-04 05:33:25 +02:00
|
|
|
RUN rm /usr/local/etc/php-fpm.conf \
|
2020-11-14 22:10:11 +01:00
|
|
|
&& echo "* * * * * /usr/local/bin/php /app/artisan schedule:run >> /dev/null 2>&1" >> /var/spool/cron/crontabs/root \
|
|
|
|
&& sed -i s/ssl_session_cache/#ssl_session_cache/g /etc/nginx/nginx.conf \
|
2020-11-14 22:58:51 +01:00
|
|
|
&& mkdir -p /var/run/php /var/run/nginx
|
2020-11-14 22:10:11 +01:00
|
|
|
|
2021-08-04 05:33:25 +02:00
|
|
|
COPY .github/docker/default.conf /etc/nginx/http.d/default.conf
|
|
|
|
COPY .github/docker/www.conf /usr/local/etc/php-fpm.conf
|
2020-11-14 22:10:11 +01:00
|
|
|
COPY .github/docker/supervisord.conf /etc/supervisord.conf
|
2018-05-18 04:53:17 +02:00
|
|
|
|
2018-07-08 17:14:20 +02:00
|
|
|
EXPOSE 80 443
|
2020-11-14 22:10:11 +01:00
|
|
|
ENTRYPOINT ["/bin/ash", ".github/docker/entrypoint.sh"]
|
2020-08-21 15:10:17 +02:00
|
|
|
CMD [ "supervisord", "-n", "-c", "/etc/supervisord.conf" ]
|