-
-
Save aS00Sa/b4a5a79385ab8b323b8820dfbf8e4463 to your computer and use it in GitHub Desktop.
Dockerfile for PHP 7.4 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: | |
| - "8080: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: | |
| - "3307:3307" | |
| 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.4-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/ \ # No longer necessary as of 7.4; https://github.com/docker-library/php/pull/910#issuecomment-559383597 | |
| --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 = 3307 | |
| [mysqld] | |
| port= 3307 | |
| 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