Skip to content

Commit cc1a6ee

Browse files
authored
Rebase dev image to Tumbleweed (#1363)
* Rebase Dev image to Tumbleweed Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com> * Enable SELinux by default but not enforce it Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com> * Install default SELinux policies Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com> --------- Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
1 parent 5058ebc commit cc1a6ee

File tree

2 files changed

+41
-9
lines changed

2 files changed

+41
-9
lines changed

Dockerfile.dev.iso

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
ARG ELEMENTAL_OS_IMAGE
22

33
FROM ${ELEMENTAL_OS_IMAGE} as os
4+
FROM ${ELEMENTAL_OS_IMAGE} as builder
45

56
COPY manifest.yaml manifest.yaml
6-
RUN elemental --debug --config-dir . build-iso -o /output -n "elemental-dev" dir:/
7+
COPY --from=os / rootfs
8+
9+
RUN elemental --debug --config-dir . build-iso -o /output -n "elemental-dev" dir:rootfs
710

811
FROM busybox:stable
912

10-
COPY --from=os /output /elemental-iso
13+
COPY --from=builder /output /elemental-iso

Dockerfile.dev.os

+36-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ FROM ${ELEMENTAL_REGISTER} as register
55
FROM ${ELEMENTAL_TOOLKIT} as toolkit
66

77
# OS base image of our choice
8-
FROM registry.opensuse.org/opensuse/leap:15.5 as OS
8+
FROM registry.opensuse.org/opensuse/tumbleweed:latest as OS
99

1010
ARG RANCHER_SYSTEM_AGENT_VERSION
1111

@@ -53,10 +53,25 @@ RUN ARCH=$(uname -m); \
5353
RUN ARCH=$(uname -m); \
5454
[[ "${ARCH}" == "aarch64" ]] && ARCH="arm64"; \
5555
zypper --non-interactive install --no-recommends -- \
56-
dmidecode
56+
dmidecode \
57+
libopenssl1_1
58+
59+
# SELinux policy and tools
60+
RUN ARCH=$(uname -m); \
61+
[[ "${ARCH}" == "aarch64" ]] && ARCH="arm64"; \
62+
zypper --non-interactive install --no-recommends -- \
63+
patterns-microos-selinux \
64+
k3s-selinux \
65+
audit
5766

5867
# Add system files
5968
COPY framework/files/ /
69+
70+
# Enable SELinux (The security=selinux arg is default on Micro, not on Tumbleweed)
71+
RUN sed -i "s/selinux=1/security=selinux selinux=1/g" /etc/elemental/bootargs.cfg
72+
# Enforce SELinux
73+
# RUN sed -i "s/enforcing=0/enforcing=1/g" /etc/elemental/bootargs.cfg
74+
6075
# Add elemental-register
6176
COPY --from=register /usr/sbin/elemental-register /usr/sbin/elemental-register
6277
COPY --from=register /usr/sbin/elemental-support /usr/sbin/elemental-support
@@ -67,17 +82,31 @@ COPY --from=toolkit /usr/bin/elemental /usr/bin/elemental
6782
ADD --chmod=0755 https://github.com/rancher/system-agent/releases/download/${RANCHER_SYSTEM_AGENT_VERSION}/rancher-system-agent-amd64 /usr/sbin/elemental-system-agent
6883

6984
# Enable essential services
70-
RUN systemctl enable NetworkManager.service
85+
RUN systemctl enable NetworkManager.service sshd
86+
87+
# This is for testing purposes, do not do this in production.
88+
RUN echo "PermitRootLogin yes" > /etc/ssh/sshd_config.d/rootlogin.conf
7189

72-
# Enable /tmp to be on tmpfs
73-
RUN cp /usr/share/systemd/tmp.mount /etc/systemd/system
90+
# Make sure trusted certificates are properly generated
91+
RUN /usr/sbin/update-ca-certificates
7492

75-
# Generate initrd with required elemental services
76-
RUN elemental init --debug --force
93+
# Ensure /tmp is mounted as tmpfs by default
94+
RUN if [ -e /usr/share/systemd/tmp.mount ]; then \
95+
cp /usr/share/systemd/tmp.mount /etc/systemd/system; \
96+
fi
97+
98+
# Save some space
99+
RUN zypper clean --all && \
100+
rm -rf /var/log/update* && \
101+
>/var/log/lastlog && \
102+
rm -rf /boot/vmlinux*
77103

78104
# Update os-release file with some metadata
79105
RUN echo TIMESTAMP="`date +'%Y%m%d%H%M%S'`" >> /etc/os-release && \
80106
echo GRUB_ENTRY_NAME=\"Elemental Dev\" >> /etc/os-release
81107

108+
# Rebuild initrd to setup dracut with the boot configurations
109+
RUN elemental init --force elemental-rootfs,elemental-sysroot,grub-config,dracut-config,cloud-config-essentials,elemental-setup,boot-assessment
110+
82111
# Good for validation after the build
83112
CMD /bin/bash

0 commit comments

Comments
 (0)