-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathDockerfile_py38fromsrc
61 lines (51 loc) · 2.21 KB
/
Dockerfile_py38fromsrc
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
ARG BASE_IMG
FROM ${BASE_IMG}
# install linux packages
# + libs for building python from sournce https://askubuntu.com/questions/21547/what-are-the-packages-libraries-i-should-install-before-compiling-python-from-so
RUN sed '[email protected]@ubuntu.ethz.ch@' -i /etc/apt/sources.list \
&& apt-get update \
&& apt-get --no-install-recommends -y install \
sudo htop tmux screen locate \
mc less vim git fish tcsh \
curl wget ca-certificates \
xz-utils p7zip-full \
cmake \
hdf5-tools h5utils \
libgomp1 ninja-build \
&& apt-get --no-install-recommends -y install \
build-essential libncursesw5-dev libreadline-dev \
libssl-dev libgdbm-dev libc6-dev libsqlite3-dev libffi-dev libdb-dev \
libbz2-dev liblzma-dev zlib1g-dev \
libexpat1-dev uuid-dev \
&& ldconfig \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# building python 3.8 from source
# Compared to python docker, we disable "--without-ensurepip"
# https://github.com/docker-library/python/blob/1b78ff417e41b6448d98d6dd6890a1f95b0ce4be/3.8/buster/Dockerfile
ENV PYTHON_VERSION="3.8.12"
RUN mkdir /tmp/python-build && cd /tmp/python-build \
&& wget "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" -O python.tar.xz \
&& tar --strip-components=1 -xf python.tar.xz \
&& ./configure --build="x86_64-linux-gnu" --enable-loadable-sqlite-extensions --enable-optimizations --enable-option-checking=fatal --enable-shared --with-system-expat --with-system-ffi \
&& make -j \
&& make install -j4 \
&& cd /tmp && rm -r /tmp/python-build \
&& ln -s /usr/local/bin/python3.8 /usr/local/bin/python \
&& ln -s /usr/local/bin/pip3 /usr/local/bin/pip \
&& ldconfig
# the ldconfig makes configs in /etc/ld.so.conf.d take effect, including /usr/local/bin
#core
#+ tools for sleeper
RUN pip --no-cache-dir install \
setuptools \
&& pip --no-cache-dir install --upgrade \
wheel virtualenv \
&& pip --no-cache-dir install --upgrade \
psutil py3nvml
RUN mkdir /opt/lab
COPY setup.sh setup_and_run_command.sh setup_and_wait.sh sleeper /opt/lab/
RUN ln -s /opt/lab/sleeper /usr/bin/sleeper
COPY setup_steps /opt/lab/setup_steps
# make sure the setup scripts are executable
RUN chmod -R a+x /opt/lab/
CMD ["/opt/lab/setup_and_wait.sh"]