-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
81 lines (74 loc) · 2.35 KB
/
Dockerfile
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
FROM ubuntu:22.04
ARG GPG_KEY=F23C5A6CF475977595C89F51BA6932366A755776
# Install common build dependencies, add deadsnakes PPA and cleanup.
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
ca-certificates \
g++ \
gcc \
git \
make; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get install -y --no-install-recommends \
dirmngr \
gnupg; \
\
export GNUPGHOME="$(mktemp -d)"; \
gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "$GPG_KEY"; \
gpg -o /usr/share/keyrings/deadsnakes.gpg --export "$GPG_KEY"; \
echo "deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/deadsnakes.gpg] https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu jammy main" >> /etc/apt/sources.list; \
\
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*
# Install Python and pip and cleanup.
RUN set -eux; \
apt-get update; \
DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
python3.9 \
python3.10 \
python3.11 \
python3.12 \
python3.13 \
\
python3.9-dev \
python3.10-dev \
python3.11-dev \
python3.12-dev \
python3.13-dev \
\
python3.9-venv \
python3.10-venv \
python3.11-venv \
python3.12-venv \
python3.13-venv \
\
python3.9-distutils \
python3.10-distutils \
python3.11-distutils \
python3.12-distutils \
\
python3-pip; \
rm -rf /var/lib/apt/lists/*; \
\
# We still use Python 3.11 as the default interpreter because system pip
# is incompatible with Python 3.12 due to deprecated pkgutil.ImpImporter.
python3.11 -m pip install --upgrade pip
# Install tox and add a user with an explicit UID/GID.
COPY requirements.txt /
RUN set -eux; \
pip3.11 install --no-deps -r /requirements.txt; \
groupadd -r tox --gid=10000; \
useradd --no-log-init -r -g tox -m --uid=10000 tox; \
mkdir /tests /home/tox/.cache; \
chown tox:tox /tests /home/tox/.cache
WORKDIR /tests
VOLUME /tests
COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]
USER tox
CMD ["tox"]