Skip to content

Commit

Permalink
MGMT-19453: Add downstream dockerfile (#841)
Browse files Browse the repository at this point in the history
  • Loading branch information
giladravid16 authored Dec 9, 2024
1 parent 817ac65 commit e74d328
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions Dockerfile.assisted_installer_agent-downstream
Original file line number Diff line number Diff line change
@@ -0,0 +1,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"

0 comments on commit e74d328

Please sign in to comment.