-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile_alpine
66 lines (55 loc) · 2.23 KB
/
Dockerfile_alpine
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
FROM alpine:latest as builder
LABEL maintainer="Ingo Meyer <[email protected]>"
ENV PYENV_ROOT "/usr/local/pyenv"
ENV PATH "${PYENV_ROOT}/bin:${PYENV_ROOT}/shims:${PATH}"
ENV LANG C.UTF-8
RUN apk --no-cache add bash \
build-base \
bzip2-dev \
ca-certificates \
curl \
git \
libffi-dev \
linux-headers \
openssl-dev \
ncurses-dev \
patch \
readline-dev \
sqlite-dev \
xz-dev \
zlib-dev
RUN curl -o "/tmp/pyenv-master.tar.gz" -L "https://github.com/pyenv/pyenv/archive/master.tar.gz" && \
tar -C /tmp/ -xvf "/tmp/pyenv-master.tar.gz" && \
mv "/tmp/pyenv-master" "${PYENV_ROOT}"
COPY patches/alpine /tmp/patches
RUN set -e; \
installed_python_versions=""; \
for version in 2.7 3.7 3.8 3.9 3.10 3.11 3.12; do \
latest_version="$(pyenv install --list | awk "NR > 1 && \$1 ~ /^$(echo "${version}" | sed 's/\./\\./g')(\.[0-9.]*)?(-dev)?$/" | tail -1 | tr -d ' ')"; \
if [ -f "/tmp/patches/posix_close_${version}.patch" ]; then \
pyenv install --patch "${latest_version}" < "/tmp/patches/posix_close_${version}.patch"; \
else \
pyenv install "${latest_version}"; \
fi; \
installed_python_versions="${latest_version} ${installed_python_versions}"; \
done; \
pyenv global ${installed_python_versions}
RUN pip install -U pip && \
pip install tox
FROM alpine:latest
ENV PYENV_ROOT "/usr/local/pyenv"
ENV PATH "${PYENV_ROOT}/bin:${PYENV_ROOT}/shims:${PATH}"
RUN apk --no-cache add bash \
bzip2 \
ca-certificates \
libffi \
openssl \
ncurses \
readline \
sqlite \
xz \
zlib
COPY --from=builder "${PYENV_ROOT}" "${PYENV_ROOT}"
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["/bin/bash"]