debian-forge-composer/distribution/Dockerfile-ubi
Tomáš Hozza 625b1578fa Port osbuild/images v0.33.0 with dot-notation to composer
Update the osbuild/images to the version which introduces "dot notation"
for distro release versions.

 - Replace all uses of distroregistry by distrofactory.
 - Delete local version of reporegistry and use the one from the
   osbuild/images.
 - Weldr: unify `createWeldrAPI()` and `createWeldrAPI2()` into a single
   `createTestWeldrAPI()` function`.
 - store/fixture: rework fixtures to allow overriding the host distro
   name and host architecture name. A cleanup function to restore the
   host distro and arch names is always part of the fixture struct.
 - Delete `distro_mock` package, since it is no longer used.
 - Bump the required version of osbuild to 98, because the OSCAP
   customization is using the 'compress_results' stage option, which is
   not available in older versions of osbuild.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-01-26 11:32:34 +01:00

45 lines
2.3 KiB
Text

FROM registry.access.redhat.com/ubi9/go-toolset:latest AS builder
# We need to be root to install packages, but ubi9/go-toolset defaults to uid 1001
USER 0
# The go package `proglottis/gpgme` a dependency of `containers/image/v5` package
# uses `libgpgme` so we need to install it and its build dependencies
RUN dnf install -y gpgme-devel libassuan-devel device-mapper-devel
USER 1001
# ubi9/go-toolset defaults to uid 1001. Let's copy the files with this UID as well.
# Otherwise, VCS stamping will fail because git >= 2.35.2 refuses to work in
# a repository owned by a different user.
COPY --chown=1001 . .
ARG COMMIT
ENV LDFLAGS="${COMMIT:+-X \'github.com/osbuild/osbuild-composer/internal/common.GitRev=${COMMIT}\'}"
ENV LDFLAGS="${LDFLAGS:+-ldflags=\"${LDFLAGS}\"}"
ENV GOFLAGS="-mod=vendor -tags=exclude_graphdriver_btrfs"
# if run without "sh -c", podman for some reason executes the command in a way,
# which results in the following error:
# [1/3] STEP 12/12: RUN go install ${LDFLAGS} ./cmd/osbuild-composer/
# invalid value "\"-X" for flag -ldflags: missing =<value> in <pattern>=<value>
RUN /usr/bin/sh -c "go install ${LDFLAGS} ./cmd/osbuild-composer/"
FROM registry.access.redhat.com/ubi9/go-toolset:latest AS builder2
RUN go install github.com/jackc/tern@latest
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
# We need to manually install all dependencies of osbuild-composer manually
# due to building the binary in a separate container and not installing an
# actual RPM.
RUN microdnf install -y python3 python3-dnf gpgme libassuan device-mapper-libs
RUN mkdir -p "/usr/libexec/osbuild-composer"
RUN mkdir -p "/etc/osbuild-composer/"
RUN mkdir -p "/run/osbuild-composer/"
RUN mkdir -p "/var/cache/osbuild-composer/"
RUN mkdir -p "/var/lib/osbuild-composer/"
RUN mkdir -p "/usr/share/osbuild-composer/"
RUN mkdir -p "/opt/migrate/"
COPY --from=builder /opt/app-root/src/go/bin/osbuild-composer /usr/libexec/osbuild-composer/
COPY ./containers/osbuild-composer/entrypoint.py /opt/entrypoint.py
COPY ./dnf-json /usr/libexec/osbuild-composer/
COPY ./pkg/jobqueue/dbjobqueue/schemas /opt/migrate/schemas
COPY --from=builder2 /opt/app-root/src/go/bin/tern /opt/migrate/
EXPOSE 8008 8080 8700
ENTRYPOINT ["python3", "/opt/entrypoint.py", "--remote-worker-api", "--composer-api", "--prometheus", "--shutdown-wait-period", "15"]