Skip to content

Commit 9b64c67

Browse files
committed
feat!: refactor on top of opensuse tumbleweed instead of ubuntu
1 parent 4c35a4d commit 9b64c67

3 files changed

Lines changed: 196 additions & 85 deletions

File tree

Dockerfile.image

Lines changed: 87 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,115 @@
1-
# Binaries and files needed from elemental-toolkit repository
21
ARG LUET_VERSION=0.34.0
32
ARG COS_VERSION=0.10.3
43

54
## Framework Build
6-
FROM quay.io/luet/base:$LUET_VERSION AS framework-build
7-
COPY framework/files/etc/luet/luet.yaml /etc/luet/luet.yaml
5+
FROM quay.io/luet/base:$LUET_VERSION AS luet
6+
# COPY framework/files/etc/luet/luet.yaml /etc/luet/luet.yaml
87
ENV LUET_NOLOCK=true
98

10-
# Hack to get grub2 artifacts into the correct places
11-
SHELL ["/usr/bin/luet", "install", "-y", "--system-target", "/grub-artifacts"]
12-
RUN system/grub2-artifacts
13-
14-
## Download K9S Tool
15-
FROM alpine AS k9s-download
16-
ARG TARGETARCH
17-
ARG K9S_VERSION=latest
18-
RUN apk add curl && \
19-
[ "$K9S_VERSION" = "latest" ] && VERSION=$(curl -s https://api.github.com/repos/derailed/k9s/releases/latest | grep "tag_name" | cut -d'"' -f4) || VERSION=$K9S_VERSION && \
20-
curl -sL https://github.com/derailed/k9s/releases/download/${VERSION}/k9s_Linux_${TARGETARCH}.tar.gz | tar -xz k9s -C /bin/
21-
# binary file will be available at /bin/k9s
22-
23-
## Base OS Selection
24-
FROM quay.io/costoolkit/releases-orange:cos-system-${COS_VERSION} AS base-os-amd64
25-
FROM quay.io/costoolkit/releases-orange-arm64:cos-system-${COS_VERSION} AS base-os-arm64
26-
## Base OS Build
27-
FROM base-os-${TARGETARCH} AS default
28-
29-
# grub2-artifacts hack
30-
COPY --from=framework-build /grub-artifacts/ /usr/share/efi/
31-
COPY --from=framework-build /grub-artifacts/ /usr/share/grub2/
32-
33-
# Copy local framework files
34-
COPY framework/files/ /
35-
36-
RUN curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.noarmor.gpg | tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null && \
37-
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.tailscale-keyring.list | tee /etc/apt/sources.list.d/tailscale.list
38-
39-
# Versions of dependencies
40-
# renovate: datasource=github-releases depName=tailscale/tailscale
41-
ENV TAILSCALE_VERSION=1.40.0
42-
43-
RUN apt-get update && apt-get autoclean && DEBIAN_FRONTEND=noninteractive apt-get install -y \
44-
tailscale=${TAILSCALE_VERSION} \
9+
# SHELL ["/usr/bin/luet", "install", "-y", "--system-target", "/framework"]
10+
# RUN system/kernel
11+
# RUN system/dracut-initrd
12+
# RUN meta/cos-minimal
13+
# RUN meta/cos-verify
14+
# RUN toolchain/luet-mtree
15+
# RUN system/cos-features
16+
17+
FROM registry.opensuse.org/opensuse/tumbleweed:latest AS default
18+
19+
# COPY --from=framework-build /framework/ /
20+
21+
# COPY framework/files/ /
22+
23+
RUN zypper --non-interactive ar -g -r https://pkgs.tailscale.com/stable/opensuse/tumbleweed/tailscale.repo && \
24+
zypper --non-interactive addrepo --refresh https://download.opensuse.org/repositories/system:/snappy/openSUSE_Tumbleweed snappy && \
25+
zypper --gpg-auto-import-keys --non-interactive ref && zypper --non-interactive in -y \
26+
aaa_base-extras \
27+
bcm43xx-firmware \
28+
conntrack-tools \
29+
coreutils \
30+
curl \
31+
device-mapper \
32+
dosfstools \
33+
dracut \
34+
e2fsprogs \
35+
findutils \
36+
gawk \
37+
gptfdisk \
38+
grub2 \
39+
grub2-arm64-efi \
40+
haveged \
41+
iproute2 \
42+
iputils \
43+
iw \
4544
jq \
45+
kernel-default \
46+
kernel-firmware-all \
47+
kmod \
48+
less \
49+
libudev1 \
50+
lsscsi \
51+
lvm2 \
52+
mdadm \
53+
multipath-tools \
54+
nano \
55+
NetworkManager \
56+
nfs-utils \
57+
open-iscsi \
58+
open-vm-tools \
59+
parted \
60+
python-azure-agent \
61+
qemu-guest-agent \
62+
raspberrypi-eeprom \
63+
rng-tools \
64+
rsync \
65+
squashfs \
66+
systemd \
67+
systemd-sysvinit \
68+
tar \
69+
timezone \
70+
vim \
71+
vim-small \
72+
which \
73+
wireless-tools \
74+
wpa_supplicant \
75+
tailscale \
4676
qrencode \
4777
dmidecode \
48-
console-data \
49-
iscsiuio \
5078
snapd \
5179
openssh-server \
5280
sudo \
53-
netplan.io \
54-
iptables-persistent \
5581
net-tools \
56-
inetutils-ping \
57-
dnsutils \
58-
vim \
82+
bind-utils \
5983
file \
60-
musl \
84+
k9s \
6185
htop \
62-
tree
86+
tree \
87+
&& zypper cc
6388

64-
# RUN snap download microk8s --channel=$MICROK8S_CHANNEL --target-directory /opt/microk8s/snaps --basename microk8s
65-
# RUN snap download core --target-directory /opt/microk8s/snaps --basename core
89+
# Configure NetworkManager as default network management service
90+
RUN zypper remove -y wicked
91+
RUN systemctl disable wicked \
92+
&& systemctl enable NetworkManager
6693

67-
COPY scripts/cloudinit /opt/microk8s/scripts
94+
# Copy the luet config file pointing to the upgrade repository
95+
COPY conf/luet.yaml /etc/luet/luet.yaml
96+
COPY --from=luet /usr/bin/luet /usr/bin/luet
97+
RUN luet install -y meta/cos-verify
98+
RUN luet install -y meta/cos-minimal
99+
RUN luet install -y system/dracut-initrd
68100

101+
COPY scripts/cloudinit /opt/microk8s/scripts
69102
RUN chmod +x /opt/microk8s/scripts/*
70103

71104
COPY overlay/files /
72105

73-
RUN setupcon --save
74-
75-
COPY --from=k9s-download /bin/k9s /usr/bin/k9s
76-
77-
# RUN apt install -y linux-image-generic initramfs-tools
78-
79-
## Workarounds for elemental installer looking for shim files (https://github.com/rancher/elemental-cli/blob/19a9832efe6cc5411f76f97204543700a7d45ea6/pkg/utils/grub.go#LL196C63-L196C81)
80-
RUN apt install -y grub-efi shim shim-signed
81-
82-
RUN ln -s /usr/bin/grub-editenv /usr/bin/grub2-editenv
83-
RUN systemctl enable systemd-networkd
84-
RUN systemctl enable ssh
85-
RUN systemctl disable set-hostname.service
86106
RUN systemctl enable microk8s-tailscale-apiserver-ip.service
87107
RUN systemctl enable tailscale-logind.service
88108
RUN systemctl enable tailscaled.service
89-
90-
# Enable tmp
91-
RUN cp -v /usr/share/systemd/tmp.mount /etc/systemd/system/
92-
RUN systemctl enable tmp.mount
93-
94-
# Fixup sudo perms
95-
RUN chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
96-
97-
98-
# Clear cache
99-
RUN rm -rf /var/cache/* && journalctl --vacuum-size=1K && (rm /etc/machine-id || true) && (rm /var/lib/dbus/machine-id || true) && (rm /etc/hostname || true)
100-
# Remove SSH Host keys generated from installing the openssh-server
101-
RUN rm -rf /etc/ssh/ssh_host_*
102-
103-
# # Rebuild initrd to setup dracut with the boot configurations
104-
RUN kernel=$(readlink -f /boot/vmlinuz) && \
105-
version=${kernel##/boot/vmlinuz-} && \
106-
mkinitrd /boot/initrd-${version} ${version} && \
107-
cd /boot && ln -sf initrd-${version} initrd
108-
109+
RUN systemctl enable getty@tty1
109110

110111
ARG OS_NAME=edgenode OS_VERSION=latest OS_ID=edgenode BUG_REPORT_URL HOME_URL OS_REPO OS_LABEL GITHUB_REPO IMAGE_COMMIT
111112
RUN envsubst > /etc/os-release < /usr/lib/os-release.tmpl
113+
114+
RUN dracut -f --regenerate-all
115+
RUN ln -sf Image /boot/vmlinuz

Dockerfile.old

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Binaries and files needed from elemental-toolkit repository
2+
ARG LUET_VERSION=0.34.0
3+
ARG COS_VERSION=0.10.3
4+
5+
## Framework Build
6+
FROM quay.io/luet/base:$LUET_VERSION AS framework-build
7+
COPY framework/files/etc/luet/luet.yaml /etc/luet/luet.yaml
8+
ENV LUET_NOLOCK=true
9+
10+
# Hack to get grub2 artifacts into the correct places
11+
SHELL ["/usr/bin/luet", "install", "-y", "--system-target", "/grub-artifacts"]
12+
RUN system/grub2-artifacts
13+
14+
## Download K9S Tool
15+
FROM alpine AS k9s-download
16+
ARG TARGETARCH
17+
ARG K9S_VERSION=latest
18+
RUN apk add curl && \
19+
[ "$K9S_VERSION" = "latest" ] && VERSION=$(curl -s https://api.github.com/repos/derailed/k9s/releases/latest | grep "tag_name" | cut -d'"' -f4) || VERSION=$K9S_VERSION && \
20+
curl -sL https://github.com/derailed/k9s/releases/download/${VERSION}/k9s_Linux_${TARGETARCH}.tar.gz | tar -xz k9s -C /bin/
21+
# binary file will be available at /bin/k9s
22+
23+
## Base OS Selection
24+
FROM quay.io/costoolkit/releases-orange:cos-system-${COS_VERSION} AS base-os-amd64
25+
FROM quay.io/costoolkit/releases-orange-arm64:cos-system-${COS_VERSION} AS base-os-arm64
26+
## Base OS Build
27+
FROM base-os-${TARGETARCH} AS default
28+
29+
# grub2-artifacts hack
30+
COPY --from=framework-build /grub-artifacts/ /usr/share/efi/
31+
COPY --from=framework-build /grub-artifacts/ /usr/share/grub2/
32+
33+
# Copy local framework files
34+
COPY framework/files/ /
35+
36+
RUN curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.noarmor.gpg | tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null && \
37+
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.tailscale-keyring.list | tee /etc/apt/sources.list.d/tailscale.list
38+
39+
RUN apt-get update && apt-get autoclean && DEBIAN_FRONTEND=noninteractive apt-get install -y \
40+
tailscale \
41+
jq \
42+
qrencode \
43+
dmidecode \
44+
console-data \
45+
iscsiuio \
46+
snapd \
47+
openssh-server \
48+
sudo \
49+
netplan.io \
50+
iptables-persistent \
51+
net-tools \
52+
inetutils-ping \
53+
dnsutils \
54+
vim \
55+
file \
56+
musl \
57+
htop \
58+
tree
59+
60+
# RUN snap download microk8s --channel=$MICROK8S_CHANNEL --target-directory /opt/microk8s/snaps --basename microk8s
61+
# RUN snap download core --target-directory /opt/microk8s/snaps --basename core
62+
63+
COPY scripts/cloudinit /opt/microk8s/scripts
64+
65+
RUN chmod +x /opt/microk8s/scripts/*
66+
67+
COPY overlay/files /
68+
69+
RUN setupcon --save
70+
71+
COPY --from=k9s-download /bin/k9s /usr/bin/k9s
72+
73+
# RUN apt install -y linux-image-generic initramfs-tools
74+
75+
## Workarounds for elemental installer looking for shim files (https://github.com/rancher/elemental-cli/blob/19a9832efe6cc5411f76f97204543700a7d45ea6/pkg/utils/grub.go#LL196C63-L196C81)
76+
RUN apt install -y grub-efi shim shim-signed
77+
78+
RUN ln -s /usr/bin/grub-editenv /usr/bin/grub2-editenv
79+
RUN systemctl enable systemd-networkd
80+
RUN systemctl enable ssh
81+
RUN systemctl disable set-hostname.service
82+
RUN systemctl enable microk8s-tailscale-apiserver-ip.service
83+
RUN systemctl enable tailscale-logind.service
84+
RUN systemctl enable tailscaled.service
85+
86+
# Enable tmp
87+
RUN cp -v /usr/share/systemd/tmp.mount /etc/systemd/system/
88+
RUN systemctl enable tmp.mount
89+
90+
# Fixup sudo perms
91+
RUN chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
92+
93+
94+
# Clear cache
95+
RUN rm -rf /var/cache/* && journalctl --vacuum-size=1K && (rm /etc/machine-id || true) && (rm /var/lib/dbus/machine-id || true) && (rm /etc/hostname || true)
96+
# Remove SSH Host keys generated from installing the openssh-server
97+
RUN rm -rf /etc/ssh/ssh_host_*
98+
99+
# # Rebuild initrd to setup dracut with the boot configurations
100+
RUN kernel=$(readlink -f /boot/vmlinuz) && \
101+
version=${kernel##/boot/vmlinuz-} && \
102+
mkinitrd /boot/initrd-${version} ${version} && \
103+
cd /boot && ln -sf initrd-${version} initrd
104+
105+
106+
ARG OS_NAME=edgenode OS_VERSION=latest OS_ID=edgenode BUG_REPORT_URL HOME_URL OS_REPO OS_LABEL GITHUB_REPO IMAGE_COMMIT
107+
RUN envsubst > /etc/os-release < /usr/lib/os-release.tmpl
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ repositories:
99
reference: repository.yaml
1010
verify: false
1111
urls:
12-
- "quay.io/costoolkit/releases-orange"
12+
- "quay.io/costoolkit/releases-green"
1313
- <<: *cos
1414
arch: "arm64"
1515
urls:
16-
- "quay.io/costoolkit/releases-orange-arm64"
16+
- "quay.io/costoolkit/releases-green-arm64"

0 commit comments

Comments
 (0)