aboutsummaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
Diffstat (limited to 'docker')
-rw-r--r--docker/base.Dockerfile23
1 files changed, 22 insertions, 1 deletions
diff --git a/docker/base.Dockerfile b/docker/base.Dockerfile
index a4a5ad1..1655aa1 100644
--- a/docker/base.Dockerfile
+++ b/docker/base.Dockerfile
@@ -19,7 +19,7 @@ RUN git clone \
WORKDIR /nsjail
RUN make
-FROM python:3.9-slim-buster
+FROM python:3.9-slim-buster as venv
ENV PIP_NO_CACHE_DIR=false
RUN apt-get -y update \
@@ -32,3 +32,24 @@ RUN pip install pipenv==2020.11.4
COPY --from=builder /nsjail/nsjail /usr/sbin/
RUN chmod +x /usr/sbin/nsjail
+
+FROM venv
+
+ARG DEV
+ENV PIP_NO_CACHE_DIR=false \
+ PIPENV_DONT_USE_PYENV=1 \
+ PIPENV_HIDE_EMOJIS=1 \
+ PIPENV_NOSPIN=1
+
+COPY Pipfile Pipfile.lock /snekbox/
+WORKDIR /snekbox
+
+RUN if [ -n "${DEV}" ]; \
+ then \
+ pipenv install --deploy --system --dev; \
+ else \
+ pipenv install --deploy --system; \
+ fi
+
+# At the end to avoid re-installing dependencies when only a config changes.
+COPY config/ /snekbox/config