reworded docker compose files to segregate responsibilites. Dev version no longer uses the nginx proxy to proxy, merely to be the static file server. Also dev version no longer used gunicorn as it was screwing up the live reload functionality and didn't provide any other benefit.
This commit is contained in:
@@ -1,18 +1,36 @@
|
||||
---
|
||||
services:
|
||||
web:
|
||||
command: gunicorn --capture-output --enable-stdio-inheritance -b 0.0.0.0:8000 website.wsgi:application
|
||||
volumes:
|
||||
- ./src:/src
|
||||
command: python manage.py runserver 0.0.0.0:8000
|
||||
volumes: [./src:/src]
|
||||
env_file:
|
||||
- path: .env.template
|
||||
required: true
|
||||
- path: .env
|
||||
required: false
|
||||
|
||||
environment:
|
||||
DJANGO_RELOAD: true
|
||||
DEBUG: true
|
||||
ALLOWED_HOSTS: localhost,127.0.0.1
|
||||
ports: [127.0.0.1:8000:8000]
|
||||
db:
|
||||
env_file:
|
||||
- path: .env.template
|
||||
required: true
|
||||
- path: .env
|
||||
required: false
|
||||
|
||||
proxy:
|
||||
restart: unless-stopped
|
||||
ports: [127.0.0.1:80:80]
|
||||
environment: [NGINX_HOSTNAME=localhost, NGINX_PORT=80]
|
||||
tailwind:
|
||||
image: python:3.14-slim
|
||||
working_dir: /src
|
||||
command: >
|
||||
sh -c "apt-get update && apt-get install -y curl &&
|
||||
curl -sL https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64
|
||||
-o /usr/local/bin/tailwindcss &&
|
||||
chmod +x /usr/local/bin/tailwindcss &&
|
||||
tailwindcss -i ./static/css/input.css -o ./static/css/output.css --watch"
|
||||
volumes: [.:/src]
|
||||
networks: [frontend]
|
||||
|
||||
@@ -1,10 +1,25 @@
|
||||
---
|
||||
services:
|
||||
web:
|
||||
command: gunicorn website.wsgi:application
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
ALLOWED_HOSTS: ${NGINX_HOSTNAME}
|
||||
DJANGO_SETTINGS_MODULE: ${DJANGO_SETTINGS_MODULE}
|
||||
env_file:
|
||||
- path: .env
|
||||
required: true
|
||||
|
||||
db:
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- path: .env
|
||||
required: true
|
||||
adminer:
|
||||
restart: unless-stopped
|
||||
proxy:
|
||||
restart: unless-stopped
|
||||
ports: [80:80, 443:443]
|
||||
environment:
|
||||
- NGINX_HOSTNAME=${NGINX_HOSTNAME}
|
||||
- NGINX_PORT=80
|
||||
- NGINX_SSL_PORT=443
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
---
|
||||
services:
|
||||
web:
|
||||
command: python manage.py check --deploy; python -Wa manage.py test --noinput --parallel
|
||||
restart: "no"
|
||||
command: python manage.py check --deploy; python -Wa manage.py test --noinput
|
||||
--parallel
|
||||
environment:
|
||||
DEBUG: false
|
||||
DJANGO_SETTINGS_MODULE: website.settings.test
|
||||
env_file:
|
||||
- path: .env.template
|
||||
required: true
|
||||
|
||||
|
||||
db:
|
||||
# Tmpfs keeps tests fast and isolated — no persistent volume needed
|
||||
tmpfs: [/var/lib/postgresql/data]
|
||||
env_file:
|
||||
- path: .env.template
|
||||
required: true
|
||||
|
||||
|
||||
25
compose.yaml
25
compose.yaml
@@ -2,16 +2,9 @@
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
command: gunicorn website.wsgi:application
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
ALLOWED_HOSTS: ${NGINX_HOSTNAME}
|
||||
DJANGO_SETTINGS_MODULE: ${DJANGO_SETTINGS_MODULE}
|
||||
# VIRTUAL_HOST: localhost
|
||||
# VIRTUAL_PORT: 8000
|
||||
restart: unless-stopped
|
||||
volumes: [static_volume:/app/static, media_volume:/app/media]
|
||||
networks: [frontend, backend]
|
||||
db:
|
||||
@@ -21,32 +14,24 @@ services:
|
||||
POSTGRES_USER: ${POSTGRES_USER}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
volumes: [postgres_data:/var/lib/postgresql]
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: [CMD-SHELL, 'pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DBNAME}']
|
||||
interval: 5s
|
||||
retries: 5
|
||||
networks: [backend]
|
||||
adminer:
|
||||
image: adminer
|
||||
depends_on: [db]
|
||||
restart: always
|
||||
ports: [127.0.0.1:8080:8080]
|
||||
networks: [backend]
|
||||
proxy:
|
||||
image: nginx:stable
|
||||
volumes:
|
||||
- ./.nginx/.templates:/etc/nginx/templates
|
||||
- static_volume:/app/static:ro
|
||||
- media_volume:/app/media:ro
|
||||
restart: unless-stopped
|
||||
ports: [80:80, 443:443]
|
||||
environment:
|
||||
- NGINX_HOSTNAME=${NGINX_HOSTNAME}
|
||||
- NGINX_PORT=80
|
||||
- NGINX_SSL_PORT=443
|
||||
depends_on: [web]
|
||||
networks: [frontend]
|
||||
adminer:
|
||||
image: adminer
|
||||
depends_on: [db]
|
||||
ports: [127.0.0.1:8080:8080]
|
||||
networks: [backend]
|
||||
networks:
|
||||
frontend:
|
||||
backend:
|
||||
|
||||
Reference in New Issue
Block a user