Skip to content

Commit 9acc3ce

Browse files
authored
dockerfiles: drop wheels from layers (#13209)
1 parent cf62d26 commit 9acc3ce

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

Dockerfile.django-alpine

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ RUN \
2929
COPY requirements.txt ./
3030
# CPUCOUNT=1 is needed, otherwise the wheel for uwsgi won't always be build succesfully
3131
# https://github.com/unbit/uwsgi/issues/1318#issuecomment-542238096
32-
RUN CPUCOUNT=1 pip3 wheel --wheel-dir=/tmp/wheels -r ./requirements.txt
32+
RUN export PYCURL_SSL_LIBRARY=openssl && \
33+
CPUCOUNT=1 pip3 wheel --wheel-dir=/tmp/wheels -r ./requirements.txt
3334

3435
FROM base AS release
3536
WORKDIR /app
@@ -55,10 +56,10 @@ RUN \
5556
&& \
5657
rm -rf /var/cache/apk/* && \
5758
true
58-
COPY --from=build /tmp/wheels /tmp/wheels
59-
COPY requirements.txt ./
60-
RUN export PYCURL_SSL_LIBRARY=openssl && \
61-
pip3 install \
59+
RUN \
60+
--mount=from=build,src=/tmp/wheels,target=/tmp/wheels \
61+
--mount=from=build,src=/app/requirements.txt,target=/app/requirements.txt \
62+
pip3 install \
6263
--no-cache-dir \
6364
--no-index \
6465
--find-links=/tmp/wheels \

Dockerfile.django-debian

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ RUN \
2828
COPY requirements.txt ./
2929
# CPUCOUNT=1 is needed, otherwise the wheel for uwsgi won't always be build succesfully
3030
# https://github.com/unbit/uwsgi/issues/1318#issuecomment-542238096
31-
RUN CPUCOUNT=1 pip3 wheel --wheel-dir=/tmp/wheels -r ./requirements.txt
31+
RUN export PYCURL_SSL_LIBRARY=openssl && \
32+
CPUCOUNT=1 pip3 wheel --wheel-dir=/tmp/wheels -r ./requirements.txt
3233

3334
FROM base AS release
3435
WORKDIR /app
@@ -58,10 +59,10 @@ RUN \
5859
apt-get clean && \
5960
rm -rf /var/lib/apt/lists && \
6061
true
61-
COPY --from=build /tmp/wheels /tmp/wheels
62-
COPY requirements.txt ./
63-
RUN export PYCURL_SSL_LIBRARY=openssl && \
64-
pip3 install \
62+
RUN \
63+
--mount=from=build,src=/tmp/wheels,target=/tmp/wheels \
64+
--mount=from=build,src=/app/requirements.txt,target=/app/requirements.txt \
65+
pip3 install \
6566
--no-cache-dir \
6667
--no-index \
6768
--find-links=/tmp/wheels \

0 commit comments

Comments
 (0)