-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.requirements
56 lines (47 loc) · 1.81 KB
/
Dockerfile.requirements
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# syntax=docker/dockerfile:1.3
# BUILD STAGE - Download dependencies
FROM python:3.12-alpine3.20 as build
RUN apk update \
&& apk add --update --no-cache \
git \
openssh \
postgresql-dev \
musl-dev \
libxslt-dev \
python3-dev \
libffi-dev \
gcc \
libcurl \
bash \
rust \
build-base \
cargo \
curl-dev \
py3-setuptools \
&& pip install --upgrade pip
COPY requirements.txt /
WORKDIR /pip-packages/
RUN pip wheel -r /requirements.txt
# RUNTIME STAGE - Copy packages from build stage and install runtime dependencies
FROM python:3.12-alpine3.20
RUN apk -U upgrade binutils busybox expat libretls && \
apk add --no-cache postgresql-libs && \
apk add --no-cache --virtual .build-deps gcc \
musl-dev \
postgresql-dev \
libxslt-dev \
python3-dev \
build-base \
libffi-dev \
openssl-dev \
make \
curl-dev \
py3-setuptools \
libcurl
WORKDIR /pip-packages/
COPY --from=build /pip-packages/ /pip-packages/
RUN rm -rf /pip-packages/src
RUN pip install --no-deps --no-index --find-links=/pip-packages/ /pip-packages/*
# Currently expat will not bump to latest if this upgrade is done earlier
# https://unix.stackexchange.com/questions/769209/unable-to-install-or-upgrade-to-specific-version-of-alpine-expat-2-6-0-r0-in-alp
RUN apk add --upgrade expat