-
Notifications
You must be signed in to change notification settings - Fork 3
/
Containerfile
162 lines (126 loc) · 4.84 KB
/
Containerfile
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
ARG PYTHON_VERSION=3.12.3
FROM python:${PYTHON_VERSION}-slim AS builder
COPY . /src
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN <<EOF
set -e
set -x
# install required packages
apt-get update
apt-get install -y --no-install-recommends \
build-essential \
gcc \
git \
libldap2-dev \
libsasl2-dev
# install python packages
mkdir /wheels
python3 -m pip --no-cache-dir install -U 'pip==24.3.1'
python3 -m pip wheel --no-cache-dir --wheel-dir=/wheels -r /src/requirements.txt
python3 -m pip wheel --no-cache-dir --wheel-dir=/wheels -r /src/requirements.ansible.txt
python3 -m pip wheel --no-cache-dir --wheel-dir=/wheels -r /src/requirements.openstack-image-manager.txt
python3 -m pip wheel --no-cache-dir --wheel-dir=/wheels -r /src/requirements.openstack-flavor-manager.txt
# install openstack-project-manager
git clone --depth 1 https://github.com/osism/openstack-project-manager.git /openstack-project-manager
python3 -m pip wheel --no-cache-dir --wheel-dir=/wheels -r /openstack-project-manager/requirements.txt
rm -rf /openstack-project-manager/.git
# install openstack-simple-stress
git clone --depth 1 https://github.com/osism/openstack-simple-stress.git /openstack-simple-stress
python3 -m pip wheel --no-cache-dir --wheel-dir=/wheels -r /openstack-simple-stress/requirements.txt
rm -rf /osism/openstack-simple-stress/.git
EOF
FROM python:${PYTHON_VERSION}-slim AS osism
ENV PYTHONWARNINGS="ignore::UserWarning"
COPY --from=builder /wheels /wheels
COPY . /src
COPY files/data /data
COPY files/change.sh /change.sh
COPY files/run-ansible-console.sh /run-ansible-console.sh
COPY requirements.yml /ansible/requirements.yml
ENV CLUSTERSHELL_CFGDIR=/etc/clustershell/
COPY files/clustershell/clush.conf /etc/clustershell/clush.conf
COPY files/clustershell/groups.conf /etc/clustershell/groups.conf
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN <<EOF
set -e
set -x
# install required packages
apt-get update
apt-get install -y --no-install-recommends \
git \
less \
openssh-client \
procps \
tini
# install python packages
python3 -m pip --no-cache-dir install -U 'pip==24.3.1'
python3 -m pip --no-cache-dir install --no-index --find-links=/wheels -r /src/requirements.txt
python3 -m pip --no-cache-dir install --no-index --find-links=/wheels -r /src/requirements.ansible.txt
python3 -m pip --no-cache-dir install --no-index --find-links=/wheels -r /src/requirements.openstack-image-manager.txt
python3 -m pip --no-cache-dir install --no-index --find-links=/wheels -r /src/requirements.openstack-flavor-manager.txt
# install python-osism
python3 -m pip --no-cache-dir install --no-index /src
# install ansible collections
mkdir -p /ansible/logs
ansible-galaxy collection install -v -f -r /ansible/requirements.yml -p /usr/share/ansible/collections
ln -s /usr/share/ansible/collections /ansible/collections
# copy image definitions for the openstack-image-manager
git clone --depth 1 https://github.com/osism/openstack-image-manager.git /openstack-image-manager
mkdir -p /etc/images
ln -s /opt/configuration/environments/openstack /etc/openstack
cp /openstack-image-manager/etc/images/* /etc/images
rm -rf /openstack-image-manager
# install openstack-project-manager
git clone --depth 1 https://github.com/osism/openstack-project-manager.git /openstack-project-manager
python3 -m pip --no-cache-dir install --no-index --find-links=/wheels -r /openstack-project-manager/requirements.txt
rm -rf /openstack-project-manager/.git
# install openstack-simple-stress
git clone --depth 1 https://github.com/osism/openstack-simple-stress.git /openstack-simple-stress
python3 -m pip --no-cache-dir install --no-index --find-links=/wheels -r /openstack-simple-stress/requirements.txt
rm -rf /osism/openstack-simple-stress/.git
# install openstack-resource-manager
git clone --depth 1 https://github.com/osism/openstack-resource-manager.git /openstack-resource-manager
rm -rf /openstack-resource-manager/.git
# add tests
git clone --depth 1 https://github.com/osism/tests.git /tests
rm -rf /tests/.git
# prepare use of clustershell
ln -s /ansible/inventory/clustershell /etc/clustershell/groups.d
# cleanup
apt-get clean
rm -rf \
/src \
/tmp/* \
/usr/share/doc/* \
/usr/share/man/* \
/var/lib/apt/lists/* \
/var/tmp/*
pip3 install --no-cache-dir pyclean==3.0.0
pyclean /usr
pip3 uninstall -y pyclean
EOF
ENTRYPOINT ["/usr/bin/tini", "--"]
FROM osism AS osism-netbox
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN <<EOF
set -e
set -x
apt-get update
apt-get install -y --no-install-recommends \
git \
tini
mkdir -p /import
git clone --depth 1 https://github.com/netbox-community/devicetype-library /devicetype-library
rm -rf /devicetype-library/.git
rm -rf /devicetype-library/elevation-images
apt-get clean
rm -rf \
/tmp/* \
/var/cache/apt \
/var/lib/apt/lists/* \
/var/tmp/*
pip3 install --no-cache-dir pyclean==3.0.0
pyclean /usr
pip3 uninstall -y pyclean
EOF
COPY files/import/* /import