Commit 0cddff3b authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

update docker compose to work with 4 services

parent 0b4075b1
Pipeline #12676 passed with stage
in 1 minute and 5 seconds
......@@ -3,9 +3,11 @@ version: '3.7'
services:
backend:
container_name: backend
build: ./backend
build:
context: ./backend
volumes:
- ./backend:/code
- django-static:/backend/public/static
ports:
- "8000:8000"
env_file: .env
......@@ -24,6 +26,8 @@ services:
- "5433:5432"
volumes:
- db-data:/var/lib/postgresql/data
networks:
- main
frontend:
build:
......@@ -42,19 +46,23 @@ services:
- NODE_ENV=development
nginx:
image: nginx:alpine
build:
context: .
dockerfile: nginx/dev/Dockerfile
ports:
- "80:80"
depends_on:
- backend
volumes:
- ./nginx/dev.conf:/etc/nginx/nginx.conf:ro
- ./nginx/dev/dev.conf:/etc/nginx/nginx.conf:ro
- django-static:/usr/src/app/static
networks:
- main
volumes:
db-data:
django-static:
networks:
main:
......
FROM nginx:1.13.12-alpine
COPY nginx/dev/dev.conf /etc/nginx/nginx.conf
COPY backend/public/static /usr/src/app/static/
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
user nginx;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
client_max_body_size 100m;
upstream backend {
server backend:8000;
}
upstream frontend {
server frontend:8080;
}
server {
listen 80;
charset utf-8;
# frontend urls
location / {
proxy_redirect off;
proxy_pass http://frontend;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}
# frontend dev-server
location /sockjs-node {
proxy_redirect off;
proxy_pass http://frontend;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# backend urls
location ~ ^/(admin|api|catalog|auth) {
proxy_redirect off;
proxy_pass http://backend;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}
# static files
location /static {
autoindex on;
alias /usr/src/app/static;
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment