Skip to content

Commit cff7cf9

Browse files
committed
Move rocky9 to restructured docker build.
1 parent 6dc2966 commit cff7cf9

3 files changed

Lines changed: 134 additions & 234 deletions

File tree

common/cmdtool

Lines changed: 113 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,21 @@ configure_base()
2121
{
2222
case "$TGT" in
2323
rocky*)
24-
# RedHat specific tools.
2524
yum install -y yum-utils
26-
dnf config-manager --enable powertools
27-
yum install -y epel-release
25+
dnf install -y dnf-plugin-config-manager
26+
dnf config-manager --enable crb
27+
dnf install -y epel-release
2828
PKGS=(
2929
ImageMagick
3030
ImageMagick-devel
3131
libyaml-devel
3232
glibc-langpack-en
33+
mercurial
3334
)
34-
yum -y install ${PKGS[@]}
35-
dnf config-manager --disable powertools
36-
yum remove -y epel-release yum-utils
35+
dnf -y install ${PKGS[@]}
36+
dnf remove -y epel-release yum-utils
37+
38+
dnf -y autoremove; dnf clean all
3739
;;
3840
ubuntu*)
3941
# Make noninteractive setting permanent
@@ -62,10 +64,13 @@ configure_sshkeys()
6264
case "$TGT" in
6365
rocky*)
6466
ssh-keygen -t rsa -N '' -f /etc/ssh/ssh_host_rsa_key
67+
#EL9 enable RSA
68+
update-crypto-policies --set DEFAULT:SHA1
6569
;;
6670
ubuntu*)
67-
# noop - nothing to do.
68-
true
71+
# Enable (deprecated) RSA
72+
echo 'HostKeyAlgorithms +ssh-rsa' >>/etc/ssh/sshd_config
73+
echo 'PubkeyAcceptedKeyTypes +ssh-rsa' >>/etc/ssh/sshd_config
6974
;;
7075
*)
7176
distro_unsupported
@@ -78,21 +83,38 @@ configure_sshkeys()
7883
sed -ri 's/^#?PubkeyAuthentication\s+.*/PubkeyAuthentication yes/' /etc/ssh/sshd_config
7984
sed -ri 's/requiretty/!requiretty/' /etc/sudoers
8085
echo 'root:docker.io' | chpasswd
81-
# Enable (deprecated) RSA
82-
echo 'HostKeyAlgorithms +ssh-rsa' >>/etc/ssh/sshd_config
83-
echo 'PubkeyAcceptedKeyTypes +ssh-rsa' >>/etc/ssh/sshd_config
8486

8587
mkdir /var/run/sshd
8688
}
8789

8890
install_locale()
8991
{
90-
# install locales package and set default locale to
91-
# 'UTF-8' for the test execution environment.
92-
apt-get -y install locales
93-
locale-gen en_US.UTF-8
94-
dpkg-reconfigure locales
95-
update-locale LANG=en_US.UTF-8
92+
case "$TGT" in
93+
rocky*)
94+
PKGS=(
95+
nc
96+
net-tools
97+
glibc-locale-source
98+
)
99+
dnf -y install ${PKGS[@]}
100+
dnf -y autoremove; dnf clean all
101+
102+
# -i: specify the locale definition file
103+
# -f: specify the character set
104+
localedef -i en_US -f UTF-8 en_US.UTF-8
105+
;;
106+
ubuntu*)
107+
# install locales package and set default locale to
108+
# 'UTF-8' for the test execution environment.
109+
apt-get -y install locales
110+
locale-gen en_US.UTF-8
111+
dpkg-reconfigure locales
112+
update-locale LANG=en_US.UTF-8
113+
;;
114+
*)
115+
distro_unsupported
116+
;;
117+
esac
96118
}
97119

98120
install_download_tools()
@@ -101,13 +123,18 @@ install_download_tools()
101123
rocky*)
102124
PKGS=(
103125
ca-certificates
104-
curl
105-
wget
126+
iproute
106127
nc
107-
iproute2
108128
net-tools
129+
procps
130+
setup
131+
subversion
132+
wget
109133
)
110134
dnf -y install ${PKGS[@]}
135+
# work around package manager confusion when installing curl.
136+
dnf -y --allowerasing install curl
137+
dnf -y autoremove; dnf clean all
111138
;;
112139
ubuntu*)
113140
PKGS=(
@@ -134,24 +161,48 @@ install_download_tools()
134161

135162
configure_testing_system()
136163
{
137-
# Not sure why this is required.
138-
find /etc/systemd/system \
139-
/lib/systemd/system \
140-
-path '*.wants/*' \
141-
-not -name '*journald*' \
142-
-not -name '*systemd-tmpfiles*' \
143-
-not -name '*systemd-user-sessions*' \
144-
-exec rm \{} \;
164+
case "$TGT" in
165+
rocky*)
166+
cd /lib/systemd/system/sysinit.target.wants/
167+
ls -1 | grep -v systemd-tmpfiles-setup.service | xargs rm
168+
rm -f /etc/systemd/system/*.wants/*
169+
rm -f /lib/systemd/system/local-fs.target.wants/*
170+
rm -f /lib/systemd/system/sockets.target.wants/*udev*
171+
rm -f /lib/systemd/system/sockets.target.wants/*initctl*
172+
rm -f /lib/systemd/system/basic.target.wants/*
173+
rm -f /lib/systemd/system/anaconda.target.wants/*
174+
systemctl preset sshd
175+
176+
# install doc files (/usr/share/docs) when installing yum packages
177+
# otherwise /usr/share/docs/st2/conf/nginx/st2.conf won't be present
178+
# https://github.com/docker-library/docs/tree/master/centos#package-documentation
179+
sed -i '/nodocs/d' /etc/yum.conf
180+
;;
181+
ubuntu*)
182+
# TO DO: This may be a pre-systemd relica.
183+
find /etc/systemd/system \
184+
/lib/systemd/system \
185+
-path '*.wants/*' \
186+
-not -name '*journald*' \
187+
-not -name '*systemd-tmpfiles*' \
188+
-not -name '*systemd-user-sessions*' \
189+
-exec rm \{} \;
145190

146-
systemctl set-default multi-user.target
191+
systemctl set-default multi-user.target
147192

148-
# The base Ubuntu 18.04 image contains a file that excludes all documentation
149-
# from being installed by packages. Specifically /usr/share/doc/*
150-
# This exclusion prevents our nginx config from being installed in the 'st2' package:
151-
# /usr/share/doc/st2/conf/nginx/st2.conf
152-
# This step removes the exclusion configuration so documentation of all future packages
153-
# will be installed.
154-
rm -rf /etc/dpkg/dpkg.cfg.d/excludes
193+
# The base Ubuntu 18.04 image contains a file that excludes
194+
# all documentation from being installed by packages.
195+
# Specifically /usr/share/doc/* This exclusion prevents our
196+
# nginx config from being installed in the 'st2' package:
197+
# /usr/share/doc/st2/conf/nginx/st2.conf
198+
# This step removes the exclusion configuration so
199+
# documentation of all future packages will be installed.
200+
rm -rf /etc/dpkg/dpkg.cfg.d/excludes
201+
;;
202+
*)
203+
distro_unsupported
204+
;;
205+
esac
155206
}
156207

157208
install_system_tools()
@@ -161,9 +212,11 @@ install_system_tools()
161212
PKGS=(
162213
git
163214
openssh-server
215+
openssh-clients
164216
sudo
165217
)
166218
dnf -y install ${PKGS[@]}
219+
dnf -y autoremove; dnf clean all
167220
;;
168221
ubuntu*)
169222
PKGS=(
@@ -208,15 +261,33 @@ install_build_dependencies()
208261
mysql-devel
209262
ncurses-devel
210263
openssl-devel
264+
pam
211265
patch
212266
postgresql-devel
213267
readline-devel
214268
sqlite-devel
269+
unzip
215270
xz
216271
xz-devel
272+
zip
217273
zlib-devel
218274
)
219275
dnf -y install ${PKGS[@]}
276+
dnf -y autoremove; dnf clean all
277+
case "$TGT" in
278+
rocky-9*)
279+
PKGS=(
280+
python39
281+
python3-devel
282+
)
283+
dnf -y install ${PKGS[@]}
284+
dnf -y autoremove; dnf clean all
285+
;;
286+
*)
287+
echo "Unsupported Redhat compatible version."
288+
exit 1
289+
;;
290+
esac
220291
;;
221292
ubuntu*)
222293
PKGS=(
@@ -259,6 +330,7 @@ install_st2_build_dependencies()
259330
openldap-devel
260331
)
261332
dnf -y install ${PKGS[@]}
333+
dnf -y autoremove; dnf clean all
262334
;;
263335
ubuntu*)
264336
PKGS=(
@@ -283,22 +355,20 @@ install_python()
283355
case "$TGT" in
284356
rocky*)
285357
PKGS=(
286-
python38
287-
python38-devel
358+
python3
359+
python3-devel
288360
rpmdevtools
289-
python3-virtualenv
290361
)
291362
dnf -y install ${PKGS[@]}
292-
# Install development tools and python3.8 for EL8
363+
dnf -y autoremove; dnf clean all
364+
293365
PYPKGS=(
294366
"virtualenv==20.30.0"
295367
"pip==25.0.1"
296368
wheel
297369
setuptools
298-
"requests[security]"
299-
venvctrl
300370
)
301-
pip3.8 install --upgrade ${PYPKGS[@]}
371+
pip3 install --upgrade ${PYPKGS[@]}
302372
rm -rf /root/.cache
303373
;;
304374
ubuntu*)

packagingbuild/rockylinux9/Dockerfile

Lines changed: 9 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,20 @@
11
FROM rockylinux:9
22

3-
# Download tools
4-
RUN yum -y install \
5-
ca-certificates \
6-
wget
3+
# Install helper command tool
4+
COPY common/cmdtool /usr/local/bin
5+
COPY common/busybee* /tmp
6+
RUN chmod +x /usr/local/bin/cmdtool
77

8-
RUN yum -y install \
9-
git \
10-
openssh
118

12-
RUN yum install -y yum-utils \
13-
&& dnf install -y dnf-plugin-config-manager \
14-
&& dnf config-manager --enable crb \
15-
&& dnf install -y epel-release \
16-
&& dnf -y install \
17-
ImageMagick \
18-
ImageMagick-devel \
19-
libyaml-devel \
20-
glibc-langpack-en \
21-
&& dnf remove -y epel-release yum-utils
9+
RUN /usr/local/bin/cmdtool install_download_tools
2210

23-
# Build tools
24-
RUN dnf -y install \
25-
autoconf \
26-
automake \
27-
bzip2 \
28-
bzip2-devel \
29-
file \
30-
gcc \
31-
gcc-c++ \
32-
glib2-devel \
33-
glibc-devel \
34-
libcurl-devel \
35-
libevent-devel \
36-
libffi-devel \
37-
libjpeg-devel \
38-
libtool \
39-
libwebp-devel \
40-
libxml2-devel \
41-
libxslt-devel \
42-
make \
43-
mysql-devel \
44-
ncurses-devel \
45-
openssl-devel \
46-
patch \
47-
postgresql-devel \
48-
readline-devel \
49-
sqlite-devel \
50-
xz \
51-
xz-devel \
52-
zlib-devel
11+
RUN /usr/local/bin/cmdtool install_system_tools
5312

54-
# St2 package build debs
55-
RUN dnf -y install \
56-
openldap-devel
13+
RUN /usr/local/bin/cmdtool configure_base
5714

58-
# Create busybee credentials and make busybee pkey available for root
59-
RUN mkdir -p /root/.ssh && chmod 700 /root/.ssh
60-
COPY ../common/busybee* /root/.ssh/
61-
RUN chmod 600 /root/.ssh/busybee && \
62-
cat root/.ssh/busybee.pub >>/root/.ssh/authorized_keys
15+
RUN /usr/local/bin/cmdtool install_build_dependencies
6316

64-
RUN yum -y install openssh-server sudo && \
65-
ssh-keygen -t rsa -N '' -f /etc/ssh/ssh_host_rsa_key
66-
67-
# 1. permit root logins and set simple password password and pubkey
68-
# 2. change requiretty to !requiretty in /etc/sudoers
69-
RUN sed -ri 's/^#?PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config && \
70-
sed -ri 's/^#?PubkeyAuthentication\s+.*/PubkeyAuthentication yes/' /etc/ssh/sshd_config && \
71-
sed -ri 's/requiretty/!requiretty/' /etc/sudoers && \
72-
echo "root:${ROOT_PW}" | chpasswd
73-
74-
RUN dnf -y install nc net-tools
75-
76-
#EL9 enable RSA
77-
RUN update-crypto-policies --set DEFAULT:SHA1
78-
79-
#
80-
# Buildenv is special environment for generating debian packages. It provides:
81-
# - All needed pre-installed development packages
82-
# - SSH access for build executor.
83-
#
84-
85-
# Install development tools and python3 for EL9
86-
RUN dnf -y install python3 python3-devel rpmdevtools && \
87-
pip3 install virtualenv==20.30.0 pip==25.0.1 wheel setuptools
88-
89-
RUN rm -rf /root/.cache
17+
RUN /usr/local/bin/cmdtool install_st2_build_dependencies
9018

9119
VOLUME ["/home/busybee/build"]
9220
EXPOSE 22

0 commit comments

Comments
 (0)