summaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
authorAndrew Godwin2022-11-18 17:24:43 -0700
committerAndrew Godwin2022-11-18 17:24:43 -0700
commit80193114909a3f6ca1eda9a47b6330ef249a8ee5 (patch)
tree488baeeb9ab98a2d27500c03af70a0a25758e91a /docker
parent81de10b70c85c5222b17d8c4358a8aa8812f2559 (diff)
downloadtakahe-80193114909a3f6ca1eda9a47b6330ef249a8ee5.tar.gz
takahe-80193114909a3f6ca1eda9a47b6330ef249a8ee5.tar.bz2
takahe-80193114909a3f6ca1eda9a47b6330ef249a8ee5.zip
Deployment re-jiggling
Diffstat (limited to 'docker')
-rw-r--r--docker/Dockerfile28
-rw-r--r--docker/start.sh6
2 files changed, 11 insertions, 23 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 14e033b..a35f1ff 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -1,29 +1,19 @@
-# Build stage
-
-FROM python:3.11.0-buster as builder
+FROM python:3.11.0-slim-buster
-RUN mkdir -p /takahe
-RUN python -m venv /takahe/.venv
-RUN apt-get update && apt-get -y install libpq-dev python3-dev
-
-WORKDIR /takahe
+RUN apt-get update && apt-get -y install libpq-dev python3-dev build-essential
COPY requirements.txt requirements.txt
-RUN . /takahe/.venv/bin/activate \
- && pip install --upgrade pip \
- && pip install --upgrade -r requirements.txt
-
-# Final image stage
+RUN pip3 install --upgrade pip \
+ && pip3 install --upgrade -r requirements.txt
-FROM python:3.11.0-slim-buster
-
-RUN apt-get update && apt-get install -y libpq5
-
-COPY --from=builder /takahe /takahe
COPY . /takahe
WORKDIR /takahe
+
+# We use development here to skip settings checks
+RUN DJANGO_SETTINGS_MODULE=takahe.settings.development python3 manage.py collectstatic
+
EXPOSE 8000
-CMD ["/takahe/docker/start.sh"]
+CMD ["sh", "/takahe/docker/start.sh"]
diff --git a/docker/start.sh b/docker/start.sh
index 99f1ed0..1c01b6e 100644
--- a/docker/start.sh
+++ b/docker/start.sh
@@ -1,7 +1,5 @@
#!/bin/sh
-. /takahe/.venv/bin/activate
+python3 manage.py migrate
-python manage.py migrate
-
-exec gunicorn takahe.asgi:application -k uvicorn.workers.UvicornWorker -b 0.0.0.0:8000
+exec gunicorn takahe.wsgi:application -w 8 -b 0.0.0.0:8000