From b7e7712f07272e1612b47d9d174f0f55d0fdd247 Mon Sep 17 00:00:00 2001 From: Mathijs van Gorcum Date: Mon, 10 Sep 2018 12:21:42 +0000 Subject: Remove build requirements after building --- docker/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 777976217d..f6da05f4ef 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -26,8 +26,9 @@ RUN cd /synapse \ && rm -rf \ setup.cfg \ setup.py \ - synapse - + synapse \ + && apk del .nacl_deps + VOLUME ["/data"] EXPOSE 8008/tcp 8448/tcp -- cgit 1.4.1 From e586916cda1f3549bd9ebab2e75d3824840c76a0 Mon Sep 17 00:00:00 2001 From: Mathijs van Gorcum Date: Mon, 10 Sep 2018 14:02:42 +0000 Subject: Move COPY before RUN and merge RUNs --- docker/Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index f6da05f4ef..b9f0acccc3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,5 +1,7 @@ FROM docker.io/python:2-alpine3.8 +COPY . /synapse + RUN apk add --no-cache --virtual .nacl_deps \ build-base \ libffi-dev \ @@ -9,12 +11,10 @@ RUN apk add --no-cache --virtual .nacl_deps \ linux-headers \ postgresql-dev \ su-exec \ - zlib-dev - -COPY . /synapse - + zlib-dev \ + # A wheel cache may be provided in ./cache for faster build -RUN cd /synapse \ + && cd /synapse \ && pip install --upgrade \ lxml \ pip \ -- cgit 1.4.1 From e957428a154ed9faf8b481947e40f74cdc65b75c Mon Sep 17 00:00:00 2001 From: Mathijs van Gorcum Date: Mon, 10 Sep 2018 14:53:05 +0000 Subject: Newsfile --- changelog.d/3834.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/3834.misc diff --git a/changelog.d/3834.misc b/changelog.d/3834.misc new file mode 100644 index 0000000000..8902f8fba7 --- /dev/null +++ b/changelog.d/3834.misc @@ -0,0 +1 @@ +Improved Dockerfile to remove build requirements after building reducing the image size. -- cgit 1.4.1 From af10fa6536bf25630f4a290c756cd7f78e394a41 Mon Sep 17 00:00:00 2001 From: Jan Christian Grünhage Date: Mon, 10 Sep 2018 17:35:01 +0200 Subject: add runtime dependencies --- docker/Dockerfile | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index b9f0acccc3..20d3fe3bd8 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,7 +2,7 @@ FROM docker.io/python:2-alpine3.8 COPY . /synapse -RUN apk add --no-cache --virtual .nacl_deps \ +RUN apk add --no-cache --virtual .build_deps \ build-base \ libffi-dev \ libjpeg-turbo-dev \ @@ -10,11 +10,16 @@ RUN apk add --no-cache --virtual .nacl_deps \ libxslt-dev \ linux-headers \ postgresql-dev \ - su-exec \ zlib-dev \ - -# A wheel cache may be provided in ./cache for faster build && cd /synapse \ + && apk add --no-cache --virtual .runtime_deps \ + libffi \ + libjpeg-turbo \ + libressl \ + libxslt \ + libpq \ + zlib \ + su-exec \ && pip install --upgrade \ lxml \ pip \ @@ -27,7 +32,7 @@ RUN apk add --no-cache --virtual .nacl_deps \ setup.cfg \ setup.py \ synapse \ - && apk del .nacl_deps + && apk del .build_deps VOLUME ["/data"] -- cgit 1.4.1