containers: simplify Dockerfile and container build

This changes the following:
 - Only produce one container. There is no particular benefit to
   supporting several different base containers, so unify on ubi
   as that is what we need ourselves.
 - Build directly from git. Now that the RPM we include in our
   container does not have any dependencies and only contains a
   couple of executables, the indirection via RPM has less value.
   Eventually the value will be reduced even further as we merge
   the entrypoint into the main binary and move dnf-json into the
   worker, leaving us with only a go binary. The only potential
   benefit might be that the build environment of RPMs is more
   clearly defined, but there is no real reason to believe that
   our mockbuild is any better than using the UBI golang build
   container.

This simplifies the container builds, and brings us more in line
with what is done in image-builder, and what is needed to deploy
to openshift.
This commit is contained in:
Tom Gundersen 2020-12-18 01:06:52 +01:00 committed by Sanne Raymaekers
parent c9077c8a7f
commit c3185466ae
3 changed files with 24 additions and 125 deletions

View file

@ -0,0 +1,18 @@
FROM registry.access.redhat.com/ubi8/go-toolset:latest AS builder
COPY . .
ENV GOFLAGS=-mod=vendor
RUN go install ./cmd/osbuild-composer/
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
RUN microdnf install python3
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/"
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/
EXPOSE 443 8700
ENTRYPOINT ["python3", "/opt/entrypoint.py", "--remote-worker-api", "--composer-api"]