ft_transcendence/docker-compose.yaml
Adrien Audebert b5bc219cd6 update
2024-07-18 13:55:01 +02:00

68 lines
1.6 KiB
YAML

services:
db:
image: postgres:16.3
container_name: postgres
restart: always
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- app-network
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
backend:
build:
context: .
dockerfile: Dockerfile
image: backend
container_name: backend
restart: always
command: /bin/sh -c "sleep 5 && venv/bin/python3 manage.py migrate --noinput && venv/bin/python3 manage.py runserver 0.0.0.0:8000"
#&& venv/bin/python manage.py collectstatic --noinput
volumes:
- helloword_project:/ft_transcendence/helloworld
ports:
- "8000:8000"
depends_on:
- db
networks:
- app-network
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT}
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8000 || exit 1"]
interval: 10s
timeout: 5s
retries: 5
volumes:
postgres_data:
driver: local
driver_opts:
type: none
device: ${POSTGRES_DATA_PATH}
o: bind
helloword_project:
driver: local
driver_opts:
type: none
device: ${PROJECT_PATH}
o: bind
networks:
app-network:
driver: bridge