Skip to content

Commit

Permalink
Add Docker Compose file for development without HTTPS
Browse files Browse the repository at this point in the history
  • Loading branch information
okeneo committed Mar 4, 2024
1 parent d0ba558 commit 75bcdad
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
67 changes: 67 additions & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
version: "3.9"

services:
api:
build:
context: ./backend
dockerfile: Dockerfile
image: backend-api:1.0
expose:
- "8000"
entrypoint: ./entrypoint-api.sh
env_file: .env.dev
volumes:
- staticfiles:/staticfiles
depends_on:
- postgres-db

celery:
build:
context: ./backend
dockerfile: Dockerfile
image: backend-celery:1.0
entrypoint: ./entrypoint-celery.sh
environment:
- CELERY_BROKER=redis://redis:6379/0
env_file: .env.dev
depends_on:
- api
- redis

redis:
image: redis:7.2.4-alpine
command: redis-server
expose:
- "6379"

postgres-db:
image: postgres:15-alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
env_file: .env.dev
expose:
- "5432"

nginx:
image: nginx:1.25.4-alpine
ports:
- "80:80"
volumes:
- staticfiles:/staticfiles
- frontend_build:/var/www/frontend
- ./nginx/default-dev.conf:/etc/nginx/conf.d/default.conf
depends_on:
- api
- frontend

frontend:
build:
context: ./frontend
dockerfile: Dockerfile
volumes:
- frontend_build:/frontend/build

volumes:
staticfiles:
frontend_build:
postgres_data:
File renamed without changes.
27 changes: 27 additions & 0 deletions nginx/default-dev.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
upstream myproject {
server api:8000;
}

server {
listen 80;

location / {
alias /var/www/frontend/;
try_files $uri $uri/ /index.html;
}

location /api {
try_files $uri @proxy_api;
}

location @proxy_api {
proxy_pass http://myproject;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
}

location /django-static/ {
alias /staticfiles/;
}
}

0 comments on commit 75bcdad

Please sign in to comment.