Skip to content

Commit 0f030d5

Browse files
Add files via upload
1 parent a7e2cfc commit 0f030d5

1 file changed

Lines changed: 118 additions & 0 deletions

File tree

Dockerfile

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
FROM buildpack-deps:buster
2+
3+
ARG firefox_ver=83.0
4+
5+
# ensure local python is preferred over distribution python
6+
ENV PATH /usr/local/bin:$PATH
7+
8+
# http://bugs.python.org/issue19846
9+
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
10+
ENV LANG C.UTF-8
11+
12+
# extra dependencies (over what buildpack-deps already includes)
13+
RUN apt-get update
14+
RUN apt-get upgrade -y
15+
RUN apt-get install -y --no-install-recommends \
16+
libbluetooth-dev \
17+
tk-dev \
18+
uuid-dev \
19+
\
20+
&& apt-get install -y --no-install-recommends --no-install-suggests \
21+
ca-certificates \
22+
&& update-ca-certificates \
23+
\
24+
# Install tools for building
25+
&& toolDeps=" \
26+
curl bzip2 \
27+
" \
28+
&& apt-get install -y --no-install-recommends --no-install-suggests \
29+
$toolDeps \
30+
\
31+
# Install dependencies for Firefox
32+
&& apt-get install -y --no-install-recommends --no-install-suggests \
33+
`apt-cache depends firefox-esr | awk '/Depends:/{print$2}'` \
34+
# additional 'firefox-esl' dependencies which is not in 'depends' list
35+
libxt6 \
36+
# Download and install Firefox
37+
&& curl -fL -o /tmp/firefox.tar.bz2 \
38+
https://ftp.mozilla.org/pub/firefox/releases/${firefox_ver}/linux-x86_64/en-GB/firefox-${firefox_ver}.tar.bz2 \
39+
&& tar -xjf /tmp/firefox.tar.bz2 -C /tmp/ \
40+
&& mv /tmp/firefox /opt/firefox \
41+
&& rm -rf /var/lib/apt/lists/*
42+
43+
ENV GPG_KEY E3FF2839C048B25C084DEBE9B26995E310250568
44+
ENV PYTHON_VERSION 3.8.6
45+
46+
RUN set -ex \
47+
\
48+
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
49+
&& wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
50+
&& export GNUPGHOME="$(mktemp -d)" \
51+
&& gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
52+
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
53+
&& { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \
54+
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
55+
&& mkdir -p /usr/src/python \
56+
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
57+
&& rm python.tar.xz \
58+
\
59+
&& cd /usr/src/python \
60+
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
61+
&& ./configure \
62+
--build="$gnuArch" \
63+
--enable-loadable-sqlite-extensions \
64+
--enable-optimizations \
65+
--enable-option-checking=fatal \
66+
--enable-shared \
67+
--with-system-expat \
68+
--with-system-ffi \
69+
--without-ensurepip \
70+
&& make -j "$(nproc)" \
71+
&& make install \
72+
&& rm -rf /usr/src/python \
73+
\
74+
&& find /usr/local -depth \
75+
\( \
76+
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
77+
-o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \
78+
-o \( -type f -a -name 'wininst-*.exe' \) \
79+
\) -exec rm -rf '{}' + \
80+
\
81+
&& ldconfig \
82+
\
83+
&& python3 --version
84+
85+
# make some useful symlinks that are expected to exist
86+
RUN cd /usr/local/bin \
87+
&& ln -s idle3 idle \
88+
&& ln -s pydoc3 pydoc \
89+
&& ln -s python3 python \
90+
&& ln -s python3-config python-config
91+
92+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
93+
ENV PYTHON_PIP_VERSION 20.3.1
94+
# https://github.com/pypa/get-pip
95+
ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/91630a4867b1f93ba0a12aa81d0ec4ecc1e7eeb9/get-pip.py
96+
ENV PYTHON_GET_PIP_SHA256 d48ae68f297cac54db17e4107b800faae0e5210131f9f386c30c0166bf8d81b7
97+
98+
RUN set -ex; \
99+
\
100+
wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \
101+
echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \
102+
\
103+
python get-pip.py \
104+
--disable-pip-version-check \
105+
--no-cache-dir \
106+
"pip==$PYTHON_PIP_VERSION" \
107+
; \
108+
pip --version; \
109+
\
110+
find /usr/local -depth \
111+
\( \
112+
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
113+
-o \
114+
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
115+
\) -exec rm -rf '{}' +; \
116+
rm -f get-pip.py
117+
118+
CMD ["python3"]

0 commit comments

Comments
 (0)