-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.image
More file actions
112 lines (87 loc) · 3.92 KB
/
Copy pathDockerfile.image
File metadata and controls
112 lines (87 loc) · 3.92 KB
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
# Binaries and files needed from elemental-toolkit repository
ARG LUET_VERSION=0.36.5
ARG COS_VERSION=0.10.3
## Framework Build
FROM quay.io/luet/base:$LUET_VERSION AS framework-build
COPY framework/files/etc/luet/luet.yaml /etc/luet/luet.yaml
ENV LUET_NOLOCK=true
# Hack to get grub2 artifacts into the correct places
SHELL ["/usr/bin/luet", "install", "-y", "--system-target", "/grub-artifacts"]
RUN system/grub2-artifacts
## Download K9S Tool
FROM alpine AS k9s-download
ARG TARGETARCH
ARG K9S_VERSION=latest
RUN apk add curl && \
[ "$K9S_VERSION" = "latest" ] && VERSION=$(curl -s https://api.github.com/repos/derailed/k9s/releases/latest | grep "tag_name" | cut -d'"' -f4) || VERSION=$K9S_VERSION && \
curl -sL https://github.com/derailed/k9s/releases/download/${VERSION}/k9s_Linux_${TARGETARCH}.tar.gz | tar -xz k9s -C /bin/
# binary file will be available at /bin/k9s
## Base OS Selection
FROM quay.io/costoolkit/releases-orange:cos-system-${COS_VERSION} AS base-os-amd64
FROM quay.io/costoolkit/releases-orange-arm64:cos-system-${COS_VERSION} AS base-os-arm64
## Base OS Build
FROM base-os-${TARGETARCH} AS default
# grub2-artifacts hack
COPY --from=framework-build /grub-artifacts/ /usr/share/efi/
COPY --from=framework-build /grub-artifacts/ /usr/share/grub2/
# Copy local framework files
COPY framework/files/ /
RUN curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.noarmor.gpg | tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null && \
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.tailscale-keyring.list | tee /etc/apt/sources.list.d/tailscale.list
# Versions of dependencies
# renovate: datasource=github-releases depName=tailscale/tailscale
ENV TAILSCALE_VERSION=1.48.1
RUN apt-get update && apt-get autoclean && DEBIAN_FRONTEND=noninteractive apt-get install -y \
tailscale=${TAILSCALE_VERSION} \
jq \
qrencode \
dmidecode \
console-data \
iscsiuio \
snapd \
openssh-server \
sudo \
netplan.io \
iptables-persistent \
net-tools \
inetutils-ping \
dnsutils \
gdisk \
vim \
file \
musl \
htop \
tree
# RUN snap download microk8s --channel=$MICROK8S_CHANNEL --target-directory /opt/microk8s/snaps --basename microk8s
# RUN snap download core --target-directory /opt/microk8s/snaps --basename core
COPY scripts/cloudinit /opt/microk8s/scripts
RUN chmod +x /opt/microk8s/scripts/*
COPY overlay/files /
RUN setupcon --save
COPY --from=k9s-download /bin/k9s /usr/bin/k9s
# RUN apt install -y linux-image-generic initramfs-tools
## Workarounds for elemental installer looking for shim files (https://github.com/rancher/elemental-cli/blob/19a9832efe6cc5411f76f97204543700a7d45ea6/pkg/utils/grub.go#LL196C63-L196C81)
RUN apt install -y grub-efi shim shim-signed
RUN ln -s /usr/bin/grub-editenv /usr/bin/grub2-editenv
RUN systemctl enable systemd-networkd
RUN systemctl enable ssh
RUN systemctl disable set-hostname.service
RUN systemctl enable microk8s-tailscale-apiserver-ip.service
RUN systemctl enable tailscale-logind.service
RUN systemctl enable tailscaled.service
# Enable tmp
RUN cp -v /usr/share/systemd/tmp.mount /etc/systemd/system/
RUN systemctl enable tmp.mount
# Fixup sudo perms
RUN chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
# Clear cache
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)
# Remove SSH Host keys generated from installing the openssh-server
RUN rm -rf /etc/ssh/ssh_host_*
# # Rebuild initrd to setup dracut with the boot configurations
RUN kernel=$(readlink -f /boot/vmlinuz) && \
version=${kernel##/boot/vmlinuz-} && \
mkinitrd /boot/initrd-${version} ${version} && \
cd /boot && ln -sf initrd-${version} initrd
ARG OS_NAME=edgenode OS_VERSION=latest OS_ID=edgenode BUG_REPORT_URL HOME_URL OS_REPO OS_LABEL GITHUB_REPO IMAGE_COMMIT
RUN envsubst > /etc/os-release < /usr/lib/os-release.tmpl