forked from elasticluster/elasticluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
79 lines (68 loc) · 2.3 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
# Dockerfile for ElastiCluster
#
# Copyright (c) 2018, 2020 Riccardo Murri <[email protected]>
# Originally contributed by Hatef Monajemi, 2017
# (see https://github.com/elasticluster/elasticluster/pull/504#issuecomment-343693251)
#
# This file is part of ElastiCluster. It can be distributed and
# modified under the same conditions as ElastiCluster.
#
FROM python:3.7-slim
# Prepare the image:
# 1. move user `root`'s home to `/home` where we shall mount
# the corresponding host directories where user data resides
# 2. create mountpoints for volumes
RUN : \
&& mkdir -p /home /home/.ssh /home/.elasticluster \
&& sed -re '1s|:/root:|:/home:|' -i /etc/passwd \
;
VOLUME /home/.ssh
VOLUME /home/.elasticluster
# Copy ElastiCluster sources
COPY ./ /home
# Install ElastiCluster
#
# This happens in three stages:
# 1. install OS-level deps of Python packages; note that we install
# explicitly both the development version of a library (needed by
# `setup.py` in some Python packages) and the DLL-only version of
# the same -- this is to avoid that DDLs are removed by
# `apt-get autoremove` later on
# 2. install ElastiCluster and dependent Python packages (with `pip install`)
# 3. cleanup and remove software used for installation to get a leaner image
#
WORKDIR /home
RUN : \
&& apt-get update \
&& apt-get install --yes --no-install-recommends \
ca-certificates \
curl \
g++ \
gcc \
libc6 libc6-dev \
libexpat1 libexpat1-dev \
libffi6 libffi-dev \
libssl1.1 libssl-dev \
make \
openssh-client \
&& pip install -e . \
&& rm -rf /home/.cache \
&& apt-get remove --purge -y \
make \
g++ \
gcc \
libc6-dev \
libexpat1-dev \
libffi-dev \
libssl-dev \
&& apt-get autoremove --yes \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/cache/apt/* \
&& rm -rf /var/cache/debconf/*.dat-old \
;
# Deploy adapter script (needs to be done last, otherwise it fails
# when running Python commands above)
COPY ./etc/docker/sitecustomize.py /usr/local/lib/python3.7/site-packages/sitecustomize.py
# Run this command by default
ENTRYPOINT ["/usr/local/bin/python", "-m", "elasticluster"]
CMD ["--help"]