Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Remove build requirements after building docker image #3834

Merged
merged 4 commits into from
Sep 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/3834.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improved Dockerfile to remove build requirements after building reducing the image size.
26 changes: 16 additions & 10 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
FROM docker.io/python:2-alpine3.8

RUN apk add --no-cache --virtual .nacl_deps \
COPY . /synapse

RUN apk add --no-cache --virtual .build_deps \
build-base \
libffi-dev \
libjpeg-turbo-dev \
libressl-dev \
libxslt-dev \
linux-headers \
postgresql-dev \
su-exec \
zlib-dev

COPY . /synapse

# A wheel cache may be provided in ./cache for faster build
RUN cd /synapse \
zlib-dev \
&& cd /synapse \
&& apk add --no-cache --virtual .runtime_deps \
libffi \
libjpeg-turbo \
libressl \
libxslt \
libpq \
zlib \
su-exec \
&& pip install --upgrade \
lxml \
pip \
Expand All @@ -26,8 +31,9 @@ RUN cd /synapse \
&& rm -rf \
setup.cfg \
setup.py \
synapse

synapse \
&& apk del .build_deps

VOLUME ["/data"]

EXPOSE 8008/tcp 8448/tcp
Expand Down