Skip to content

Commit 3682d90

Browse files
diewdurbin
andauthored
Remove all platform-level dependencies (#18150)
* Remove all platform-level dependencies * Add back make for docs build * Add make back to dev build as well * Restore mount cache --------- Co-authored-by: Ee Durbin <[email protected]>
1 parent 6309fc1 commit 3682d90

File tree

1 file changed

+17
-32
lines changed

1 file changed

+17
-32
lines changed

Dockerfile

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,15 @@ RUN set -eux; \
5050
rm -f /etc/apt/apt.conf.d/docker-clean; \
5151
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache;
5252

53-
# Install System level build requirements, this is done before
54-
# everything else because these are rarely ever going to change.
53+
# Install System level build requirements, this is done before everything else
54+
# because these are rarely ever going to change.
5555
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
5656
--mount=type=cache,target=/var/lib/apt,sharing=locked \
5757
set -x \
5858
&& apt-get update \
59-
&& apt-get install --no-install-recommends -y \
60-
build-essential git libcairo2-dev libfreetype6-dev libjpeg-dev libpng-dev libz-dev
59+
&& apt-get install --no-install-recommends -y build-essential \
60+
&& apt-get clean \
61+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
6162

6263
# We create an /opt directory with a virtual environment in it to store our
6364
# application in.
@@ -124,23 +125,6 @@ ARG CI=no
124125
# i.e. 'docker compose run --rm web python -m warehouse shell --type=ipython')
125126
ARG IPYTHON=no
126127

127-
# By default, Docker has special steps to avoid keeping APT caches in the layers, which
128-
# is good, but in our case, we're going to mount a special cache volume (kept between
129-
# builds), so we WANT the cache to persist.
130-
RUN set -eux; \
131-
rm -f /etc/apt/apt.conf.d/docker-clean; \
132-
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache;
133-
134-
# Install System level Warehouse build requirements, this is done before
135-
# everything else because these are rarely ever going to change.
136-
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
137-
--mount=type=cache,target=/var/lib/apt,sharing=locked \
138-
set -x \
139-
&& apt-get update \
140-
&& apt-get install --no-install-recommends -y \
141-
build-essential libffi-dev libxml2-dev libxslt-dev libpq-dev libcurl4-openssl-dev libssl-dev \
142-
$(if [ "$DEVEL" = "yes" ]; then echo 'libjpeg-dev'; fi)
143-
144128
# We create an /opt directory with a virtual environment in it to store our
145129
# application in.
146130
RUN set -x \
@@ -208,23 +192,24 @@ ARG DEVEL=no
208192
# as well for the matrix!
209193
ARG CI=no
210194

211-
# This is a work around because otherwise postgresql-client bombs out trying
212-
# to create symlinks to these directories.
213-
RUN set -x \
214-
&& mkdir -p /usr/share/man/man1 \
215-
&& mkdir -p /usr/share/man/man7
195+
# By default, Docker has special steps to avoid keeping APT caches in the layers, which
196+
# is good, but in our case, we're going to mount a special cache volume (kept between
197+
# builds), so we WANT the cache to persist.
198+
RUN set -eux; \
199+
rm -f /etc/apt/apt.conf.d/docker-clean; \
200+
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache;
216201

217202
# Install System level Warehouse requirements, this is done before everything
218203
# else because these are rarely ever going to change.
219204
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
220205
--mount=type=cache,target=/var/lib/apt,sharing=locked \
221206
set -x \
222-
&& apt-get update \
223-
&& apt-get install --no-install-recommends -y \
224-
libpq5 libxml2 libxslt1.1 libcurl4 \
225-
$(if [ "$DEVEL" = "yes" ]; then echo 'bash libjpeg62 postgresql-client build-essential libffi-dev libxml2-dev libxslt-dev libpq-dev libcurl4-openssl-dev libssl-dev vim oathtool'; fi) \
226-
&& apt-get clean \
227-
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
207+
&& if [ "$DEVEL" = "yes" ]; then \
208+
apt-get update \
209+
&& apt-get install --no-install-recommends -y build-essential postgresql-client \
210+
&& apt-get clean \
211+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*; \
212+
fi
228213

229214
# Copy the directory into the container, this is done last so that changes to
230215
# Warehouse itself require the least amount of layers being invalidated from

0 commit comments

Comments
 (0)