Last active
May 29, 2020 13:50
-
-
Save fhdalikhan/a0841998be26e17845ef5e807ef794a4 to your computer and use it in GitHub Desktop.
Dockerfile for PHP 7.1 FPM Alpine
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
server { | |
listen 80; | |
index index.php index.html; | |
server_name localhost; | |
error_log /var/log/nginx/error.log; | |
access_log /var/log/nginx/access.log; | |
root /var/www/html/public; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass php:9000; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param PATH_INFO $fastcgi_path_info; | |
} | |
} |
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
version: '3' | |
networks: | |
laravel: | |
services: | |
nginx: | |
image: nginx:stable-alpine | |
container_name: nginx | |
ports: | |
- "8011:80" | |
volumes: | |
- .:/var/www/html | |
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf | |
depends_on: | |
- php | |
- mysql | |
networks: | |
- laravel | |
mysql: | |
image: mysql:5.7.29 | |
container_name: mysql | |
restart: unless-stopped | |
tty: true | |
ports: | |
- "3308:3308" | |
environment: | |
MYSQL_DATABASE: homestead | |
MYSQL_USER: homestead | |
MYSQL_PASSWORD: secret | |
MYSQL_ROOT_PASSWORD: secret | |
SERVICE_TAGS: dev | |
SERVICE_NAME: mysql | |
volumes: | |
- dbdata:/var/lib/mysql/ | |
- ./docker/mysql/my.cnf:/etc/mysql/my.cnf | |
networks: | |
- laravel | |
php: | |
build: | |
context: . | |
dockerfile: Dockerfile | |
container_name: php | |
volumes: | |
- .:/var/www/html | |
ports: | |
- "9000:9000" | |
networks: | |
- laravel | |
composer: | |
image: composer:latest | |
container_name: composer | |
volumes: | |
- .:/var/www/html | |
working_dir: /var/www/html | |
depends_on: | |
- php | |
networks: | |
- laravel | |
npm: | |
image: node:13.7 | |
container_name: npm | |
volumes: | |
- .:/var/www/html | |
working_dir: /var/www/html | |
entrypoint: ['npm'] | |
artisan: | |
build: | |
context: . | |
dockerfile: Dockerfile | |
container_name: artisan | |
volumes: | |
- .:/var/www/html | |
depends_on: | |
- mysql | |
working_dir: /var/www/html | |
entrypoint: ['php', '/var/www/html/artisan'] | |
networks: | |
- laravel | |
volumes: | |
dbdata: | |
driver: local |
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:7.1-fpm-alpine | |
WORKDIR /var/www/html | |
# Setup GD extension | |
RUN apk add --no-cache \ | |
freetype \ | |
libjpeg-turbo \ | |
libpng \ | |
freetype-dev \ | |
libjpeg-turbo-dev \ | |
libpng-dev \ | |
&& docker-php-ext-configure gd \ | |
--with-freetype=/usr/include/ \ | |
--with-png=/usr/include/ \ | |
--with-jpeg=/usr/include/ \ | |
&& docker-php-ext-install -j$(nproc) gd \ | |
&& docker-php-ext-enable gd \ | |
&& apk del --no-cache \ | |
freetype-dev \ | |
libjpeg-turbo-dev \ | |
libpng-dev \ | |
&& rm -rf /tmp/* | |
RUN apk add libzip-dev | |
RUN docker-php-ext-install pdo pdo_mysql zip bcmath |
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
[client] | |
port = 3308 | |
[mysqld] | |
port= 3308 | |
general_log = 1 | |
general_log_file = /var/lib/mysql/general.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment