aboutsummaryrefslogtreecommitdiffstats
path: root/static-builds
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2021-10-10 01:30:55 +0300
committerGravatar Hassan Abouelela <[email protected]>2021-10-10 01:30:55 +0300
commit595185d826286b7b832d66a5b35e0f7ecbe29c55 (patch)
treecff6548a86dc826900431e871f172ce716bf3ef5 /static-builds
parentAdds Static Route Configurations (diff)
Adds Static Docker Build
Adds a docker image which performs a static build of the site.
Diffstat (limited to 'static-builds')
-rw-r--r--static-builds/Dockerfile28
1 files changed, 28 insertions, 0 deletions
diff --git a/static-builds/Dockerfile b/static-builds/Dockerfile
new file mode 100644
index 00000000..a70165a0
--- /dev/null
+++ b/static-builds/Dockerfile
@@ -0,0 +1,28 @@
+# Build a static preview of the site
+FROM --platform=linux/amd64 python:3.9-slim-buster
+
+# Allow service to handle stops gracefully
+STOPSIGNAL SIGQUIT
+
+# Set pip to have cleaner logs and no saved cache
+ENV PIP_NO_CACHE_DIR=false \
+ POETRY_VIRTUALENVS_CREATE=false
+
+# Install poetry
+RUN pip install -U poetry
+
+# Copy the project files into working directory
+WORKDIR /app
+
+# Install project dependencies
+COPY pyproject.toml poetry.lock ./
+RUN poetry install --no-dev
+
+ARG git_sha="development"
+ENV GIT_SHA=$git_sha
+ENV PARENT_HOST=replace_me.host
+
+# Copy the source code in last to optimize rebuilding the image
+COPY . .
+
+RUN SECRET_KEY=dummy_value python manage.py distill-local build --traceback --force --collectstatic