Created
December 10, 2017 14:47
-
-
Save li0nel/3ce8e82fc12e198325752b6d0b3360f8 to your computer and use it in GitHub Desktop.
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
| FROM php:fpm | |
| # Update packages and install composer and PHP dependencies. | |
| RUN apt-get update && \ | |
| DEBIAN_FRONTEND=noninteractive apt-get install -y \ | |
| postgresql-client \ | |
| libpq-dev \ | |
| libfreetype6-dev \ | |
| libjpeg62-turbo-dev \ | |
| libmcrypt-dev \ | |
| libpng12-dev \ | |
| libbz2-dev \ | |
| php-pear \ | |
| cron \ | |
| && pecl channel-update pecl.php.net \ | |
| && pecl install apcu | |
| # PHP Extensions | |
| RUN docker-php-ext-install mcrypt zip bz2 mbstring pdo pdo_pgsql pcntl \ | |
| && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ | |
| && docker-php-ext-install gd | |
| # Memory Limit | |
| RUN echo "memory_limit=1024M" > $PHP_INI_DIR/conf.d/memory-limit.ini | |
| RUN echo "max_execution_time=900" >> $PHP_INI_DIR/conf.d/memory-limit.ini | |
| RUN echo "extension=apcu.so" > $PHP_INI_DIR/conf.d/apcu.ini | |
| # Time Zone | |
| RUN echo "date.timezone=${PHP_TIMEZONE:-UTC}" > $PHP_INI_DIR/conf.d/date_timezone.ini | |
| # Display errors in stderr | |
| RUN echo "display_errors=stderr" > $PHP_INI_DIR/conf.d/display-errors.ini | |
| # Disable PathInfo | |
| RUN echo "cgi.fix_pathinfo=0" > $PHP_INI_DIR/conf.d/path-info.ini | |
| # Disable expose PHP | |
| RUN echo "expose_php=0" > $PHP_INI_DIR/conf.d/path-info.ini | |
| # Install Composer | |
| RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | |
| ADD . /var/www/html | |
| WORKDIR /var/www/html | |
| RUN mkdir storage/logs | |
| RUN touch storage/logs/laravel.log | |
| RUN mkdir public/images | |
| RUN composer install | |
| RUN chmod -R 777 /var/www/html/storage | |
| RUN touch /var/log/cron.log | |
| ADD deploy/cron/artisan-schedule-run /etc/cron.d/artisan-schedule-run | |
| RUN chmod 0644 /etc/cron.d/artisan-schedule-run | |
| RUN chmod +x /etc/cron.d/artisan-schedule-run | |
| RUN touch /var/log/cron.log | |
| CMD env /bin/bash -o posix -c 'export -p' > /etc/cron.d/project_env.sh | |
| && chmod +x /etc/cron.d/project_env.sh | |
| && crontab /etc/cron.d/artisan-schedule-run | |
| && cron | |
| && tail -f /var/log/cron.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment