Skip to content

Instantly share code, notes, and snippets.

@globax89
Forked from Palwisha-18/docker-compose.yml
Created June 9, 2023 11:08
Show Gist options
  • Save globax89/f3d09486c93ee101485b4df8e0249230 to your computer and use it in GitHub Desktop.
Save globax89/f3d09486c93ee101485b4df8e0249230 to your computer and use it in GitHub Desktop.
DRF project docker-compose.yml
version: '3'
services:
web_app_db:
restart: always
container_name: web-app-db
image: postgres:11
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_NAME=${POSTGRES_NAME}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
ports:
- "${POSTGRES_LOCAL_PORT}:${POSTGRES_PORT}"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_NAME}"]
interval: 5s
timeout: 5s
retries: 5
django_backend:
container_name: django-backend
build:
context: .
dockerfile: DockerFile
entrypoint: /entrypoint.sh
command: bash -c "python manage.py runserver 0.0.0.0:${DJANGO_PORT}"
ports:
- "${DJANGO_PORT}:${DJANGO_PORT}"
volumes:
- .:/django_project
depends_on:
web_app_db:
condition: service_healthy
restart: on-failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment