Created
February 29, 2020 00:34
-
-
Save featherbear/b2c198ba625027335acb79f57239900e to your computer and use it in GitHub Desktop.
Crater Dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##### STAGE 1 ##### | |
FROM composer as composer | |
# Copy composer files from project root into composer container's working dir | |
COPY composer.* /app/ | |
# Copy database directory for autoloader optimization | |
COPY database /app/database | |
# Run composer to build dependencies in vendor folder | |
RUN composer install --no-scripts --no-suggest --no-interaction --prefer-dist --optimize-autoloader | |
# Copy everything from project root into composer container's working dir | |
COPY . /app | |
RUN composer dump-autoload --optimize --classmap-authoritative | |
##### STAGE 2 ##### | |
# FROM php:7.3.12-fpm-alpine | |
FROM trafex/alpine-nginx-php7:latest | |
USER root | |
# Use the default production configuration | |
#RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" | |
RUN apk add --no-cache libpng-dev libxml2-dev oniguruma-dev libzip-dev gnu-libiconv php-bcmath php-ctype php-json php-gd php-mbstring php-pdo php-pdo_mysql php-tokenizer php-xml php-zip | |
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php | |
# Set container's working dir | |
WORKDIR /app | |
# Copy everything from project root into php container's working dir | |
COPY . /app | |
# Copy vendor folder from composer container into php container | |
COPY --from=composer /app/vendor /app/vendor | |
#RUN touch database/database.sqlite && \ | |
# cp .env.example .env && \ | |
# php artisan config:cache && \ | |
# php artisan passport:keys && \ | |
# php artisan key:generate && \ | |
# chown -R www-data:www-data . && \ | |
# chmod -R 755 . && \ | |
# chmod -R 775 storage/framework/ && \ | |
# chmod -R 775 storage/logs/ && \ | |
# chmod -R 775 bootstrap/cache/ | |
RUN touch database/database.sqlite && cp .env.example .env && php artisan config:cache && php artisan passport:keys && php artisan key:generate --force && chmod -R 755 . && chmod -R 775 storage/framework/ && chmod -R 775 storage/logs/ && chmod -R 775 bootstrap/cache/ | |
RUN chown -R nobody . | |
COPY nginx.custom.conf /etc/nginx/nginx.conf | |
# RUN chown -R www-data:www-data . | |
EXPOSE 8080 | |
USER nobody | |
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] | |
HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:8080/fpm-ping |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment