summaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
authorAndrew Godwin2022-11-21 17:15:00 -0700
committerAndrew Godwin2022-11-21 16:26:53 -0700
commit45c7e0a38c5e0dac2538bfe5fb3253fdaeece534 (patch)
tree006897324856509bf7c3ea72bd44fc9115172492 /docker
parentf62fd13cbca50e871063ace72381059bb58d64ce (diff)
downloadtakahe-45c7e0a38c5e0dac2538bfe5fb3253fdaeece534.tar.gz
takahe-45c7e0a38c5e0dac2538bfe5fb3253fdaeece534.tar.bz2
takahe-45c7e0a38c5e0dac2538bfe5fb3253fdaeece534.zip
Rework dockerfile and compose to separate migrations
Diffstat (limited to 'docker')
-rw-r--r--docker/Dockerfile2
-rw-r--r--docker/docker-compose.yml58
-rw-r--r--docker/start.sh5
3 files changed, 34 insertions, 31 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 7bc9935..9235bba 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -19,4 +19,4 @@ EXPOSE 8000
# Set some sensible defaults
ENV GUNICORN_CMD_ARGS="--workers 8"
-CMD ["sh", "/takahe/docker/start.sh"]
+CMD ["gunicorn", "takahe.wsgi:application", "-b", "0.0.0.0:8000"]
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index 2e6620a..71c01e6 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -1,4 +1,28 @@
-version: "3"
+version: "3.4"
+
+x-takahe-common:
+ &takahe-common
+ build: .
+ image: takahe:latest
+ environment:
+ DJANGO_SETTINGS_MODULE: takahe.settings.production
+ PGHOST: db
+ PGDATABASE: takahe
+ PGUSER: postgres
+ PGPASSWORD: insecure_password
+ TAKAHE_SECRET_KEY: insecure_secret
+ TAKAHE_MAIN_DOMAIN: example.com
+ TAKAHE_EMAIL_CONSOLE_ONLY: "true"
+ TAKAHE_MEDIA_BACKEND: local
+ TAKAHE_AUTO_ADMIN_EMAIL: admin@example.com
+ networks:
+ - external_network
+ - internal_network
+ restart: on-failure
+ depends_on:
+ - db
+ volumes:
+ - ..:/takahe/
services:
db:
@@ -11,34 +35,18 @@ services:
- internal_network
restart: always
environment:
- - "POSTGRES_DB=takahe"
- - "POSTGRES_USER=postgres"
- - "POSTGRES_PASSWORD=insecure_password"
+ POSTGRES_DB: takahe
+ POSTGRES_USER: postgres
+ POSTGRES_PASSWORD: insecure_password
web:
- build: .
- image: takahe:latest
- environment:
- - "DJANGO_SETTINGS_MODULE=takahe.settings.production"
- - "PGHOST=db"
- - "PGDATABASE=takahe"
- - "PGUSER=postgres"
- - "PGPASSWORD=insecure_password"
- - "TAKAHE_SECRET_KEY=insecure_secret"
- - "TAKAHE_MAIN_DOMAIN=example.com"
- - "TAKAHE_EMAIL_CONSOLE_ONLY=True"
- - "TAKAHE_MEDIA_BACKEND=local"
- - "TAKAHE_AUTO_ADMIN_EMAIL=admin@example.com"
- networks:
- - external_network
- - internal_network
- restart: always
- depends_on:
- - db
+ <<: *takahe-common
ports:
- "8000:8000"
- volumes:
- - ../:/takahe/
+
+ setup:
+ <<: *takahe-common
+ command: ["/takahe/manage.py", "migrate"]
networks:
internal_network:
diff --git a/docker/start.sh b/docker/start.sh
deleted file mode 100644
index d7dd3fd..0000000
--- a/docker/start.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-python3 manage.py migrate
-
-exec gunicorn takahe.wsgi:application -b 0.0.0.0:8000