aboutsummaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
authorGravatar Leon Sandøy <[email protected]>2019-09-14 22:11:22 +0200
committerGravatar GitHub <[email protected]>2019-09-14 22:11:22 +0200
commit4d4691bc4feffb89470625e013a70d7d64f46a2f (patch)
tree298a514d6ccce9af6ee3ca41bcf3f35794cfe503 /docker
parentRename .github/FUNDING.yml to .github/.github/FUNDING.yml (diff)
parentMerge pull request #41 from python-discord/fix-flake8-docstrings (diff)
Merge pull request #22 from python-discord/revitalisation
Revitalisation
Diffstat (limited to 'docker')
-rw-r--r--docker/Dockerfile11
-rw-r--r--docker/Dockerfile.webapp25
-rw-r--r--docker/base.Dockerfile46
-rw-r--r--docker/venv.Dockerfile13
4 files changed, 42 insertions, 53 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index e8fa8a5..5ef8a88 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -1,10 +1,7 @@
-FROM pythondiscord/snekbox-base:latest
+FROM pythondiscord/snekbox-venv:latest
+
+ENTRYPOINT ["pipenv", "run"]
+CMD ["snekbox"]
-RUN mkdir -p /snekbox
COPY . /snekbox
WORKDIR /snekbox
-
-RUN pipenv --rm
-RUN pipenv sync
-
-CMD ["pipenv", "run", "snekbox"]
diff --git a/docker/Dockerfile.webapp b/docker/Dockerfile.webapp
deleted file mode 100644
index 988926d..0000000
--- a/docker/Dockerfile.webapp
+++ /dev/null
@@ -1,25 +0,0 @@
-FROM python:3.6.6-alpine3.7
-
-RUN apk add --update tini
-RUN apk add --update build-base
-
-ENV PIPENV_VENV_IN_PROJECT=1
-ENV PIPENV_IGNORE_VIRTUALENVS=1
-ENV PIPENV_NOSPIN=1
-ENV PIPENV_HIDE_EMOJIS=1
-ENV PYTHONPATH=/webapp
-
-RUN pip install pipenv
-
-RUN mkdir -p /webapp
-COPY Pipfile /webapp
-COPY Pipfile.lock /webapp
-COPY . /webapp
-WORKDIR /webapp
-
-RUN pipenv sync --dev
-
-EXPOSE 5000
-
-ENTRYPOINT ["/sbin/tini", "--"]
-CMD ["pipenv", "run", "snekweb"]
diff --git a/docker/base.Dockerfile b/docker/base.Dockerfile
index cdbd98e..1edff49 100644
--- a/docker/base.Dockerfile
+++ b/docker/base.Dockerfile
@@ -1,23 +1,27 @@
-FROM python:3.6.6-alpine3.7
+FROM alpine:3.10 as builder
+RUN apk add --no-cache --update \
+ bison~=3.3 \
+ bsd-compat-headers~=0.7 \
+ flex~=2.6 \
+ g++~=8.3 \
+ gcc~=8.3 \
+ git~=2.22 \
+ libnl3-dev~=3.4 \
+ linux-headers~=4.19 \
+ make~=4.2 \
+ protobuf-dev~=3.6
+RUN git clone https://github.com/google/nsjail.git /nsjail \
+ && cd /nsjail \
+ && git checkout 0b1d5ac03932c140f08536ed72b4b58741e7d3cf
+WORKDIR /nsjail
+RUN make
-RUN apk add --no-cache libstdc++ protobuf
-RUN apk add --update build-base
-
-ENV PIPENV_VENV_IN_PROJECT=1
-ENV PIPENV_IGNORE_VIRTUALENVS=1
-ENV PIPENV_NOSPIN=1
-ENV PIPENV_HIDE_EMOJIS=1
-ENV PYTHONPATH=/snekbox
-
-RUN pip install pipenv
-
-RUN mkdir -p /snekbox
-COPY Pipfile /snekbox
-COPY Pipfile.lock /snekbox
-COPY . /snekbox
-WORKDIR /snekbox
-
-RUN pipenv sync --dev
-
-RUN cp binaries/nsjail2.5-alpine-x86_64 /usr/sbin/nsjail
+FROM python:3.7.4-alpine3.10
+ENV PIP_NO_CACHE_DIR=false
+RUN apk add --no-cache --update \
+ libnl3~=3.4 \
+ libstdc++~=8.3 \
+ protobuf~=3.6
+RUN pip install pipenv==2018.11.26
+COPY --from=builder /nsjail/nsjail /usr/sbin/
RUN chmod +x /usr/sbin/nsjail
diff --git a/docker/venv.Dockerfile b/docker/venv.Dockerfile
new file mode 100644
index 0000000..85188fd
--- /dev/null
+++ b/docker/venv.Dockerfile
@@ -0,0 +1,13 @@
+FROM pythondiscord/snekbox-base:latest
+
+ARG DEV
+ENV PIP_NO_CACHE_DIR=false \
+ PIPENV_DONT_USE_PYENV=1 \
+ PIPENV_HIDE_EMOJIS=1 \
+ PIPENV_NOSPIN=1 \
+ PIPENV_VENV_IN_PROJECT=1
+
+COPY Pipfile Pipfile.lock /snekbox/
+WORKDIR /snekbox
+
+RUN if [ -n "${DEV}" ]; pipenv sync --dev; then pipenv sync; fi