NO-ISSUE: Reduce assisted-service-build image size
Reduce the final size of assisted-service-build image from 3.5GB to
2.8GB.
+FROM registry.ci.openshift.org/openshift/release:golang-1.17 AS golang
+RUN chmod g+xw -R /usr/local/go
+
FROM quay.io/centos/centos:stream8
ENV GOPATH=/go
@@ -10,8 +13,8 @@ ENV PATH="$VIRTUAL_ENV/bin:$GOROOT/bin:$GOPATH/bin:$TOOLS:$PATH"
COPY --from=quay.io/app-sre/golangci-lint:v1.37.1 /usr/bin/golangci-lint /usr/bin/golangci-lint
COPY --from=quay.io/goswagger/swagger:v0.28.0 /usr/bin/swagger /usr/bin/goswagger
COPY --from=quay.io/edge-infrastructure/swagger-codegen-cli:2.4.18 /opt/swagger-codegen-cli /opt/swagger-codegen-cli
-COPY --from=registry.ci.openshift.org/openshift/release:golang-1.17 /usr/bin/gotestsum /usr/bin/make /usr/bin/
-COPY --from=registry.ci.openshift.org/openshift/release:golang-1.17 /usr/local/go /usr/local/go
+COPY --from=golang /usr/bin/gotestsum /usr/bin/make /usr/bin/
+COPY --from=golang /usr/local/go /usr/local/go
COPY --from=quay.io/openshift/origin-cli:latest /usr/bin/oc /usr/bin
COPY --from=quay.io/operator-framework/upstream-opm-builder:v1.16.1 /bin/opm /bin
@@ -24,6 +27,8 @@ RUN dnf install -y 'dnf-command(config-manager)' && \
WORKDIR /home/assisted-service
RUN mkdir build $TOOLS --mode g+xw
COPY ./hack/setup_env.sh ./dev-requirements.txt ./
-RUN ./setup_env.sh podman_remote && ./setup_env.sh assisted_service
-RUN chmod g+xw -R $GOPATH && chmod g+xw -R $(go env GOROOT)
+RUN ./setup_env.sh podman_remote && \
+ ./setup_env.sh assisted_service && \
+ dnf clean all && \
+ chmod g+xw -R $GOPATH
COPY ./data /tmp/data
