Created
November 5, 2019 08:51
-
-
Save pumano/34e5a9962899e8f67255c41ce189d1c8 to your computer and use it in GitHub Desktop.
php + nginx + composer docker-compose for development
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; | |
listen [::]:80; | |
server_name localhost; | |
index index.php index.html; | |
error_log /var/log/nginx/error.log; | |
access_log /var/log/nginx/access.log; | |
root /var/www/html; | |
location / { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass 127.0.0.1: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' | |
services: | |
web: | |
image: nginx:alpine | |
ports: | |
- "8082:80" | |
volumes: | |
- "./api:/var/www/html" | |
- "./default.conf:/etc/nginx/conf.d/default.conf" | |
depends_on: | |
- php | |
networks: | |
- www | |
php: | |
build: | |
context: . | |
ports: | |
- "9000:9000" | |
volumes: | |
- "./api:/app" | |
networks: | |
- www | |
networks: | |
www: |
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 composer:1.7 as builder | |
COPY composer.json composer.lock /app/ | |
RUN composer install \ | |
--ignore-platform-reqs \ | |
--no-autoloader \ | |
--no-interaction \ | |
--no-scripts | |
COPY ./api /app/ | |
RUN composer dump-autoload --optimize --classmap-authoritative | |
FROM php:7.2-fpm-alpine | |
WORKDIR /app | |
RUN apk --update upgrade \ | |
&& apk add zip unzip wget curl | |
COPY --from=builder /app /var/www/html/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment