-
Notifications
You must be signed in to change notification settings - Fork 107
/
Dockerfile
137 lines (119 loc) · 4.06 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# Modified by chaimleib March 2023 from
# https://github.com/vicamo/docker-pyenv/blob/main/alpine/Dockerfile
#
# Changes:
# * customize the versions of python installed
# * remove the dependency on github.com/momo-lab/xxenv-latest
# * forbid failures when building python
# * add other tools like parallel
# * run intervaltree tests
FROM alpine:latest AS base
ENV PYENV_ROOT="/opt/pyenv"
ENV PYENV_SHELL="bash"
ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:$PATH"
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
# runtime dependencies
RUN set -eux; \
apk update; \
apk add --no-cache \
bash \
build-base \
bzip2 \
ca-certificates \
curl \
expat \
git \
libffi \
mpdecimal \
ncurses-libs \
openssl \
parallel \
readline \
sqlite-libs \
tk \
xz \
zlib \
;
RUN set -eux; \
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash; \
pyenv update
FROM base AS builder
# runtime dependencies
RUN set -eux; \
apk update; \
apk add --no-cache \
bzip2-dev \
libffi-dev \
ncurses-dev \
openssl-dev \
readline-dev \
sqlite-dev \
tk-dev \
xz-dev \
zlib-dev \
;
FROM builder AS build-2.7.18
RUN set -eux; pyenv install 2.7.18; \
find ${PYENV_ROOT}/versions -depth \
\( \
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
-o \( -type f -a -name 'wininst-*.exe' \) \
\) -exec rm -rf '{}' +
FROM builder AS build-3.6.15
RUN set -eux; pyenv install 3.6.15; \
find ${PYENV_ROOT}/versions -depth \
\( \
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
-o \( -type f -a -name 'wininst-*.exe' \) \
\) -exec rm -rf '{}' +
FROM builder AS build-3.7.16
RUN set -eux; pyenv install 3.7.16; \
find ${PYENV_ROOT}/versions -depth \
\( \
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
-o \( -type f -a -name 'wininst-*.exe' \) \
\) -exec rm -rf '{}' +
FROM builder AS build-3.8.16
RUN set -eux; pyenv install 3.8.16; \
find ${PYENV_ROOT}/versions -depth \
\( \
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
-o \( -type f -a -name 'wininst-*.exe' \) \
\) -exec rm -rf '{}' +
FROM builder AS build-3.9.16
RUN set -eux; pyenv install 3.9.16; \
find ${PYENV_ROOT}/versions -depth \
\( \
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
-o \( -type f -a -name 'wininst-*.exe' \) \
\) -exec rm -rf '{}' +
FROM builder AS build-3.10.10
RUN set -eux; pyenv install 3.10.10; \
find ${PYENV_ROOT}/versions -depth \
\( \
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
-o \( -type f -a -name 'wininst-*.exe' \) \
\) -exec rm -rf '{}' +
FROM builder AS build-3.11.2
RUN set -eux; pyenv install 3.11.2; \
find ${PYENV_ROOT}/versions -depth \
\( \
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
-o \( -type f -a -name 'wininst-*.exe' \) \
\) -exec rm -rf '{}' +
FROM base AS tester
COPY --from=build-2.7.18 /opt/pyenv/versions/2.7.18 /opt/pyenv/versions/2.7.18
COPY --from=build-3.6.15 /opt/pyenv/versions/3.6.15 /opt/pyenv/versions/3.6.15
COPY --from=build-3.7.16 /opt/pyenv/versions/3.7.16 /opt/pyenv/versions/3.7.16
COPY --from=build-3.8.16 /opt/pyenv/versions/3.8.16 /opt/pyenv/versions/3.8.16
COPY --from=build-3.9.16 /opt/pyenv/versions/3.9.16 /opt/pyenv/versions/3.9.16
COPY --from=build-3.10.10 /opt/pyenv/versions/3.10.10 /opt/pyenv/versions/3.10.10
COPY --from=build-3.11.2 /opt/pyenv/versions/3.11.2 /opt/pyenv/versions/3.11.2
RUN set -eux; \
pyenv rehash; \
pyenv versions
WORKDIR /intervaltree
COPY . .
CMD [ "scripts/testall.sh" ]