1
- FROM ubuntu:20.04
1
+ FROM ubuntu:20.04 AS base
2
2
3
3
ENV LANG="C.UTF-8"
4
4
ENV LC_ALL="C.UTF-8"
5
5
ENV PATH="/opt/pyenv/shims:/opt/pyenv/bin:$PATH"
6
6
ENV PYENV_ROOT="/opt/pyenv"
7
7
ENV PYENV_SHELL="bash"
8
8
9
+ # runtime dependencies
10
+ RUN apt-get update --quiet && \
11
+ apt-get install -y --no-install-recommends \
12
+ bzip2 \
13
+ ca-certificates \
14
+ curl \
15
+ git \
16
+ libexpat1 \
17
+ $(apt-cache search --names-only 'libffi[0-9]+$' 2>/dev/null | awk '{print $1}' ) \
18
+ $(apt-cache search --names-only 'libmpdec[0-9]+$' 2>/dev/null | awk '{print $1}' ) \
19
+ libncursesw5 \
20
+ $(apt-cache show libncursesw6 >/dev/null 2>&1 && echo libncursesw6 || true) \
21
+ $(apt-cache search --names-only 'libreadline[0-9]+$' 2>/dev/null | awk '{print $1}' ) \
22
+ libsqlite3-0 \
23
+ libssl1.1 \
24
+ lzma \
25
+ zlib1g
26
+
27
+ RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash && \
28
+ git clone https://github.com/momo-lab/xxenv-latest $PYENV_ROOT/plugins/xxenv-latest && \
29
+ pyenv update
30
+
31
+ # ---
32
+
33
+ FROM base as build
34
+
35
+ # builder dependencies
9
36
RUN apt-get update && apt-get install -y --no-install-recommends \
10
37
build-essential \
11
38
ca-certificates \
@@ -18,14 +45,26 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
18
45
libssl-dev \
19
46
zlib1g-dev
20
47
21
- RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash && \
22
- git clone https://github.com/momo-lab/xxenv-latest $PYENV_ROOT/plugins/xxenv-latest && \
23
- pyenv update
24
-
25
48
RUN pyenv latest install 3.6 && \
26
49
pyenv latest install 3.7 && \
27
50
pyenv latest install 3.8 && \
28
- pyenv latest install 3.9
29
- RUN pyenv global $(pyenv versions --bare | tac)
51
+ pyenv latest install 3.9 && \
52
+ pyenv global $(pyenv versions --bare | tac) && \
53
+ pyenv versions && \
54
+ find ${PYENV_ROOT}/versions -depth \
55
+ \( \
56
+ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
57
+ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \
58
+ -o \( -type f -a -name 'wininst-*.exe' \) \
59
+ \) -exec rm -rf '{}' + && \
60
+ pip install tox tox-pyenv
61
+
62
+ # ---
63
+
64
+ FROM base
65
+
66
+ COPY --from=build ${PYENV_ROOT}/versions/ ${PYENV_ROOT}/versions/
30
67
31
- RUN pip install tox tox-pyenv
68
+ RUN pyenv rehash && \
69
+ pyenv global $(pyenv versions --bare | tac) && \
70
+ pyenv versions
0 commit comments