-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile-lite
43 lines (40 loc) · 1.7 KB
/
Dockerfile-lite
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
FROM python:3.9-alpine
ENV ANSIBLE_VER=2.10.6
EASZLAB_ANSIBLE_TAG=2.10.6-lite
RUN set -x \
# Build dependencies
&& apk --no-cache add --virtual build-dependencies \
gcc \
musl-dev \
python3-dev \
libffi-dev \
openssl-dev \
cargo \
build-base \
# Useful tools
&& apk --no-cache add \
bash \
openssh-client \
rsync \
&& pip install pip --upgrade \
&& pip install --no-cache-dir \
ansible=="$ANSIBLE_VER" \
# Remove unnecessary ansible packages
&& mv /usr/local/lib/python3.9/site-packages/ansible_collections/ansible /tmp \
&& mv /usr/local/lib/python3.9/site-packages/ansible_collections/community /tmp \
&& rm -rf /usr/local/lib/python3.9/site-packages/ansible_collections/* \
&& mv /tmp/ansible /tmp/community /usr/local/lib/python3.9/site-packages/ansible_collections \
&& mv /usr/local/lib/python3.9/site-packages/ansible_collections/community/crypto /tmp \
&& mv /usr/local/lib/python3.9/site-packages/ansible_collections/community/general /tmp \
&& mv /usr/local/lib/python3.9/site-packages/ansible_collections/community/network /tmp \
&& rm -rf /usr/local/lib/python3.9/site-packages/ansible_collections/community/* \
&& mv /tmp/crypto /tmp/general /tmp/network /usr/local/lib/python3.9/site-packages/ansible_collections/community/ \
# Some module need '/usr/bin/python' exist
&& ln -s -f /usr/local/bin/python3 /usr/bin/python \
&& ln -s -f /usr/local/bin/python3 /usr/bin/python3 \
# Cleaning
&& apk del build-dependencies \
&& rm -rf /var/cache/apk/* \
&& rm -rf /root/.cache \
&& rm -rf /root/.cargo
CMD [ "sleep", "360000000" ]