2020-10-26 17:00:02 +00:00
|
|
|
version: "3.7"
|
|
|
|
|
|
|
|
services:
|
|
|
|
caddy: # https://hub.docker.com/_/caddy
|
|
|
|
image: caddy:2-alpine
|
|
|
|
restart: unless-stopped
|
|
|
|
ports:
|
|
|
|
- "80:80"
|
|
|
|
- "443:443"
|
|
|
|
volumes:
|
2020-11-14 11:10:51 +00:00
|
|
|
- ./caddy/Caddyfile:/etc/caddy/Caddyfile:ro
|
|
|
|
- ./volumes/caddy/data/:/data/:rw
|
|
|
|
- ./volumes/caddy/config/:/config/:rw
|
2020-11-22 12:02:35 +00:00
|
|
|
# Servce django static files with caddy:
|
2020-11-14 19:12:39 +00:00
|
|
|
- ./volumes/django/static/:/srv/static/:ro
|
2020-10-26 17:00:02 +00:00
|
|
|
environment:
|
|
|
|
- HOSTNAME=${HOSTNAME:-localhost}
|
|
|
|
- LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL:-internal}
|
|
|
|
|
2020-11-22 11:51:14 +00:00
|
|
|
django:
|
2020-10-26 17:00:02 +00:00
|
|
|
build:
|
|
|
|
context: .
|
|
|
|
dockerfile: Dockerfile
|
2020-11-23 17:37:03 +00:00
|
|
|
args:
|
|
|
|
- PROJECT_PACKAGE_NAME=${PROJECT_PACKAGE_NAME}
|
|
|
|
- PROJECT_VERSION=${PROJECT_VERSION}
|
2020-10-26 17:00:02 +00:00
|
|
|
restart: unless-stopped
|
2020-11-22 11:51:14 +00:00
|
|
|
hostname: django
|
2020-10-26 17:00:02 +00:00
|
|
|
ports:
|
|
|
|
- "8000"
|
|
|
|
env_file: ./common.env
|
|
|
|
environment:
|
2020-11-14 19:12:39 +00:00
|
|
|
- DJANGO_SETTINGS_MODULE=docker_settings
|
2020-10-26 17:00:02 +00:00
|
|
|
- HOSTNAME=${HOSTNAME:-localhost}
|
2020-11-22 11:51:14 +00:00
|
|
|
- DB_NAME=${PROJECT_NAME}
|
2020-10-26 17:00:02 +00:00
|
|
|
links:
|
|
|
|
- postgres:postgres
|
|
|
|
depends_on:
|
|
|
|
- postgres
|
|
|
|
- caddy
|
|
|
|
volumes:
|
2020-11-14 19:12:39 +00:00
|
|
|
- ./django/:/django/:ro
|
|
|
|
- ./volumes/django/:/django_volumes/:rw
|
2020-11-22 12:02:35 +00:00
|
|
|
# static files, served by caddy:
|
2020-11-14 19:12:39 +00:00
|
|
|
- ./volumes/django/static/:/static/:rw
|
2020-11-22 12:02:35 +00:00
|
|
|
# Use files, served by django:
|
|
|
|
- ./volumes/django/media/:/media/:rw
|
2020-10-26 17:00:02 +00:00
|
|
|
# e.g.: pip cache must be the same value as $XDG_CACHE_HOME !
|
|
|
|
- ./volumes/cache/:/var/cache/:rw
|
2020-11-14 19:12:39 +00:00
|
|
|
entrypoint: /django/entrypoint.sh
|
2020-10-26 17:00:02 +00:00
|
|
|
|
|
|
|
postgres:
|
|
|
|
# https://hub.docker.com/_/postgres
|
|
|
|
image: postgres:11-alpine
|
|
|
|
restart: unless-stopped
|
|
|
|
hostname: postgres
|
|
|
|
ports:
|
|
|
|
- "5432"
|
|
|
|
env_file: ./common.env
|
|
|
|
environment:
|
2020-11-22 11:51:14 +00:00
|
|
|
- DB_NAME=${PROJECT_NAME}
|
2020-10-26 17:00:02 +00:00
|
|
|
- POSTGRES_HOST_AUTH_METHOD=trust
|
|
|
|
volumes:
|
|
|
|
- ./postgres/init-user-db.sh:/docker-entrypoint-initdb.d/init-user-db.sh:ro
|
|
|
|
- ./volumes/postgresql/data/:/var/lib/postgresql/data/:rw
|