53 lines
1.2 KiB
YAML
53 lines
1.2 KiB
YAML
|
version: "3"
|
||
|
|
||
|
services:
|
||
|
db:
|
||
|
image: postgres:latest
|
||
|
environment:
|
||
|
- POSTGRES_USER=postgres
|
||
|
- POSTGRES_PASSWORD=postgres
|
||
|
- POSTGRES_DB=postgres
|
||
|
volumes:
|
||
|
- postgresql-data:/var/lib/postgresql/data
|
||
|
|
||
|
app:
|
||
|
build: .
|
||
|
command: bash -c 'while !</dev/tcp/db/5432; do sleep 1; done; python3 manage.py collectstatic --no-input; python3 manage.py migrate; uvicorn mysite.asgi:application --port 8000 --host 0.0.0.0 --reload'
|
||
|
environment:
|
||
|
- DJANGO_SETTINGS_MODULE=mysite.settings
|
||
|
volumes:
|
||
|
- static:/app/staticfiles
|
||
|
- .:/app/.
|
||
|
depends_on:
|
||
|
- db
|
||
|
restart: on-failure
|
||
|
|
||
|
api:
|
||
|
build: .
|
||
|
command: bash -c 'while !</dev/tcp/db/5432; do sleep 1; done; uvicorn mysite.asgi:fastapp --port 8000 --host 0.0.0.0 --reload'
|
||
|
depends_on:
|
||
|
- db
|
||
|
environment:
|
||
|
- DJANGO_SETTINGS_MODULE=mysite.settings
|
||
|
volumes:
|
||
|
- .:/app/.
|
||
|
restart: on-failure
|
||
|
|
||
|
nginx:
|
||
|
command: nginx -g "daemon off;"
|
||
|
depends_on:
|
||
|
- api
|
||
|
- app
|
||
|
image: nginx:alpine
|
||
|
restart: on-failure
|
||
|
volumes:
|
||
|
- ./nginx.conf:/etc/nginx/nginx.conf
|
||
|
- static:/var/www/app/static
|
||
|
ports:
|
||
|
- "127.0.0.1:8000:8000"
|
||
|
|
||
|
|
||
|
volumes:
|
||
|
postgresql-data:
|
||
|
static:
|