aboutsummaryrefslogtreecommitdiffstats
path: root/Dockerfile
diff options
context:
space:
mode:
authorGravatar swfarnsworth <[email protected]>2021-09-05 07:43:44 -0400
committerGravatar swfarnsworth <[email protected]>2021-09-05 07:43:44 -0400
commit12c09e08ca50a271372adeaf0cb21d6c4ca9ccea (patch)
tree1ac76fddbc476001133aac2f55e414269de47744 /Dockerfile
parentAdd `tutorial` and `video` tags for RealPython. (diff)
parentMerge pull request #581 from python-discord/Pin-platform-in-Dockerfile (diff)
Merge with main, resolve conflicts.
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile14
1 files changed, 13 insertions, 1 deletions
diff --git a/Dockerfile b/Dockerfile
index 5594b458..046e7f80 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3.9.5-slim-buster
+FROM --platform=linux/amd64 python:3.9-slim-buster
# Allow service to handle stops gracefully
STOPSIGNAL SIGQUIT
@@ -24,6 +24,18 @@ ENV GIT_SHA=$git_sha
# Copy the source code in last to optimize rebuilding the image
COPY . .
+# Set dummy variables so collectstatic can load settings.py
+RUN \
+ # Set BUILDING_DOCKER to anything but undefined so settings.py
+ # does not insert django_prometheus into the list of installed apps.
+ # This prevents django_prometheus from attempting to connect to the database
+ # when the collectstatic task is ran.
+ BUILDING_DOCKER=yes \
+ SECRET_KEY=dummy_value \
+ DATABASE_URL=postgres://localhost \
+ METRICITY_DB_URL=postgres://localhost \
+ python manage.py collectstatic --noinput --clear
+
# Run web server through custom manager
ENTRYPOINT ["python", "manage.py"]
CMD ["run"]