Initial Docker support

This commit adds:
1. A Dockerfile that runs PHP 7.2 FPM on Alpine Linux
2. A example docker-compose file that simplifies deployment
This commit is contained in:
Birkhoff Lee
2019-11-21 12:54:22 +08:00
parent 017577db42
commit 8bc5ea2d5e
4 changed files with 124 additions and 0 deletions

31
Dockerfile Normal file
View File

@ -0,0 +1,31 @@
FROM php:7.2-fpm-alpine
# Use the default production configuration
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
RUN apk add --no-cache curl git tar unzip libpng-dev libxml2-dev
RUN docker-php-ext-install bcmath && \
docker-php-ext-install ctype && \
docker-php-ext-install json && \
docker-php-ext-install gd && \
docker-php-ext-install mbstring && \
docker-php-ext-install pdo && \
docker-php-ext-install pdo_mysql && \
docker-php-ext-install tokenizer && \
docker-php-ext-install xml && \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
composer --version
WORKDIR /var/www
COPY . /var/www
RUN composer install --optimize-autoloader && \
php artisan config:cache && \
chmod -R 755 storage bootstrap/cache && \
chown -R www-data:www-data storage
EXPOSE 9000
CMD ["php-fpm"]