PyInventory/deployment/docker-compose.yml

66 wiersze
2.1 KiB
YAML
Czysty Zwykły widok Historia

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:
- ./caddy/Caddyfile:/etc/caddy/Caddyfile:ro
- ./volumes/caddy/data/:/data/:rw
- ./volumes/caddy/config/:/config/:rw
# Servce django static files with caddy:
- ./volumes/django/static/:/srv/static/:ro
2020-10-26 17:00:02 +00:00
environment:
- HOSTNAME=${HOSTNAME:-localhost}
- LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL:-internal}
django:
2020-10-26 17:00:02 +00:00
build:
context: .
dockerfile: Dockerfile
args:
- PROJECT_PACKAGE_NAME=${PROJECT_PACKAGE_NAME}
- PROJECT_VERSION=${PROJECT_VERSION}
2020-10-26 17:00:02 +00:00
restart: unless-stopped
hostname: django
2020-10-26 17:00:02 +00:00
ports:
- "8000"
env_file: ./common.env
environment:
- DJANGO_SETTINGS_MODULE=docker_settings
2020-10-26 17:00:02 +00:00
- HOSTNAME=${HOSTNAME:-localhost}
- DB_NAME=${PROJECT_NAME}
2020-10-26 17:00:02 +00:00
links:
- postgres:postgres
depends_on:
- postgres
- caddy
volumes:
- ./django/:/django/:ro
- ./volumes/django/:/django_volumes/:rw
# static files, served by caddy:
- ./volumes/django/static/:/static/:rw
# 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
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:
- 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