When the container with osbuild-composer gets built in our CI or by AppSRE, we do not set the composer version to any value (as we do when we built RPMs). As a result, the version reported by composer is always "devel". This is not useful for debugging and determining the used version of composer. In addition, this information now gets exposed in Koji builds, therefore it makes sense to make it useful. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
42 lines
2 KiB
Text
42 lines
2 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
|
|
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
|
|
# 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
|
|
RUN microdnf install -y python3 python3-dnf
|
|
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"]
|