-
Notifications
You must be signed in to change notification settings - Fork 82
/
Dockerfile.assisted_installer_agent-downstream
81 lines (70 loc) · 3.4 KB
/
Dockerfile.assisted_installer_agent-downstream
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
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/go-toolset:1.21 AS builder
ARG TARGETPLATFORM
ENV USER_UID=1001 \
USER_NAME=assisted-installer
ENV COMPONENT_NAME=assisted-installer-agent
ENV COMPONENT_VERSION=1.0.0
ENV COMPONENT_TAG_EXTENSION=" "
ENV GOFLAGS="-p=4"
COPY --chown=${USER_UID} . /app
WORKDIR /app
RUN make build
RUN go install github.com/google/[email protected]
RUN ${HOME}/go/bin/go-licenses save --save_path /tmp/licenses ./...
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/ubi:9.4
ARG release=main
ARG version=latest
COPY --from=builder /tmp/licenses /licenses
COPY --from=builder /app/build/agent /usr/bin/agent
# The step binaries are all just symlinks to /usr/bin/agent
RUN ln -s /usr/bin/agent /usr/bin/free_addresses && \
ln -s /usr/bin/agent /usr/bin/inventory && \
ln -s /usr/bin/agent /usr/bin/logs_sender && \
ln -s /usr/bin/agent /usr/bin/next_step_runner && \
ln -s /usr/bin/agent /usr/bin/disk_speed_check
COPY --from=builder /app/scripts/installer/* /usr/local/bin/
RUN INSTALL_PKGS="dhclient ipmitool sg3_utils file kmod findutils iputils nmap podman chrony fio openssh-clients hwdata" && \
X86_PKGS=$(if [ "$(uname -m)" == "x86_64" ]; then echo -n biosdevname dmidecode ; fi) && \
ARM_PKGS=$(if [ "$(uname -m)" == "aarch64" ]; then echo -n dmidecode ; fi) && \
PPC64LE_PKGS=$(if [ "$(uname -m)" == "ppc64le" ]; then echo -n '' ; fi) && \
S390X_PKGS=$(if [ "$(uname -m)" == "s390x" ]; then echo -n '' ; fi) && \
subscription-manager refresh && \
dnf install -y $INSTALL_PKGS $X86_PKGS $ARM_PKGS $PPC64LE_PKGS $S390X_PKGS && \
dnf clean all && \
rm -rf /var/cache/{yum,dnf}/* && \
# Remove RPM/DNF files to reduce image size
rm -rf /var/lib/rpm/rpmdb.sqlite /var/lib/dnf && \
# Remove Python cache
find /usr/lib64/ -type d -name __pycache__ | xargs rm -rf && \
# Remove GeoIP database
rm -rf /usr/share/GeoIP && \
# Clean unnecessary nmap files to reduce image size
find /usr/share/nmap/ -mindepth 1 -maxdepth 1 | grep -v nmap-payloads | xargs rm -rf && \
# Remove cracklib installed as part of systemd to reduce image size
rm -rf /usr/share/cracklib && \
# Remove manpages && docs to reduce image size
rm -rf /usr/share/man /usr/share/doc && \
# Remove dbus-1 information (we're not running dbus in the container)
rm -rf /usr/share/dbus-1 && \
# Remove pip/setuptools wheels
rm -rf /usr/share/python3-wheels/pip* /usr/share/python3-wheels/setuptools* && \
# Remove log
rm -rf /var/log/lastlog && \
# Remove unnecessary fio ceph stuff
rm -rf /usr/lib64/ceph librbd.so.* librados.so.*
LABEL com.redhat.component="assisted-installer-agent-container" \
name="assisted-installer-agent" \
version="${version}" \
upstream-ref="${version}" \
upstream-url="https://github.com/openshift/assisted-installer-agent.git" \
summary="OpenShift Assisted Installer Agent" \
io.k8s.display-name="OpenShift Assisted Installer" \
maintainer="Liat Gamliel <[email protected]>" \
description="OpenShift Assisted Installer" \
io.k8s.description="OpenShift Assisted Installer" \
distribution-scope="public" \
release="${release}" \
vendor="Red Hat, Inc." \
upstream_commit="${version}" \
org.label-schema.vcs-ref="${version}" \
org.label-schema.vcs-url="https://github.com/openshift/assisted-installer-agent"