forked from rancher/elemental
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.image
83 lines (69 loc) · 2.84 KB
/
Dockerfile.image
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
# ARGS go first if used on FROM
ARG OPERATOR_IMAGE=quay.io/costoolkit/elemental-operator-ci:latest
ARG REGISTER_IMAGE=quay.io/costoolkit/elemental-register-ci:latest
ARG SYSTEM_AGENT_IMAGE=rancher/system-agent:v0.2.9
ARG TOOL_IMAGE=quay.io/costoolkit/elemental-cli-ci:latest
# Binaries and files needed from elemental-toolkit repository
ARG LUET_VERSION=0.32.5
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
SHELL ["/usr/bin/luet", "install", "-y", "--system-target", "/framework"]
# elemental-toolkit essentials
RUN system/immutable-rootfs
RUN system/cos-setup
RUN cloud-config/network
RUN cloud-config/recovery
RUN cloud-config/live
RUN cloud-config/boot-assessment
RUN cloud-config/default-services
RUN system/grub2-config
RUN system/base-dracut-modules
# elemental-toolkit utilities
RUN utils/k9s
RUN utils/nerdctl
RUN toolchain/cosign
RUN selinux/rancher
# elemental-operator
FROM $OPERATOR_IMAGE as elemental-operator
# elemental-register
FROM $REGISTER_IMAGE as elemental-register
# rancher-system-agent
FROM $SYSTEM_AGENT_IMAGE as system-agent
FROM $TOOL_IMAGE as elemental-cli
# Base os
FROM registry.suse.com/suse/sle-micro-rancher/5.3:latest as default
# Copy installed files from the luet repos
COPY --from=framework-build /framework /
# Copy elemental-operator
COPY --from=elemental-operator /usr/sbin/elemental-operator /usr/sbin/elemental-operator
# Copy elemental-register
COPY --from=elemental-register /usr/sbin/elemental-register /usr/sbin/elemental-register
# Copy elemental-support
COPY --from=elemental-register /usr/sbin/elemental-support /usr/sbin/elemental-support
# Copy rancher-system-agent as elemental-system-agent to avoid clashes
COPY --from=system-agent /usr/bin/rancher-system-agent /usr/sbin/elemental-system-agent
# Copy elemental
COPY --from=elemental-cli /usr/bin/elemental /usr/bin/elemental
# Copy local framework files
COPY framework/files/ /
# Enable services
RUN systemctl enable NetworkManager sshd elemental-populate-node-labels systemd-timesyncd shutdown-containerd
ARG IMAGE_TAG=latest
ARG IMAGE_COMMIT=""
ARG IMAGE_REPO=norepo
RUN echo COMMIT=\"${IMAGE_COMMIT}\" >> /etc/os-release
RUN echo IMAGE_REPO=\"${IMAGE_REPO}\" >> /etc/os-release
RUN echo IMAGE_TAG=\"${IMAGE_TAG}\" >> /etc/os-release
RUN echo IMAGE=\"${IMAGE_REPO}:${IMAGE_TAG}\" >> /etc/os-release
RUN echo TIMESTAMP="`date +'%Y%m%d%H%M%S'`" >> /etc/os-release
RUN echo GRUB_ENTRY_NAME=\"Elemental\" >> /etc/os-release
# Rebuild initrd to setup dracut with the boot configurations
RUN mkinitrd && \
# aarch64 has an uncompressed kernel so we need to link it to vmlinuz
kernel=$(ls /boot/Image-* | head -n1) && \
if [ -e "$kernel" ]; then ln -sf "${kernel#/boot/}" /boot/vmlinuz; fi
# Save some space
RUN rm -rf /var/log/update* && \
>/var/log/lastlog && \
rm -rf /boot/vmlinux*