summaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
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