Skip to content

Commit

Permalink
Automate Local Image Pruning (#3587)
Browse files Browse the repository at this point in the history
* adding labels to each stage in docker file ci-rp
* added a new makefile target ci-clean to prune local images
* removing ci-portal from .PHONY accidentally came with previous commit
  • Loading branch information
safwank97 authored Jun 6, 2024
1 parent 31c7252 commit 470884a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Dockerfile.ci-rp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ARG ARO_VERSION
# builder is responsible for all compilation and validation of the RP
###############################################################################
FROM ${REGISTRY}/ubi8/nodejs-16 as portal-build
LABEL aro-portal-build=true
WORKDIR /build/portal/v2
USER root

Expand All @@ -23,6 +24,7 @@ RUN npm run lint && npm run build
###############################################################################
FROM ${REGISTRY}/ubi8/go-toolset:1.20.12-5 AS builder
ARG ARO_VERSION
LABEL aro-builder=true
USER root
WORKDIR /app

Expand Down Expand Up @@ -61,6 +63,7 @@ RUN hack/fips/validate-fips.sh ./aro
# Stage 3: final is our slim image with minimal layers and tools
###############################################################################
FROM ${REGISTRY}/ubi8/ubi-minimal AS final
LABEL aro-final=true
RUN microdnf update && microdnf clean all
COPY --from=builder /app/aro /app/e2e.test /usr/local/bin/
ENTRYPOINT ["aro"]
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ client: generate
ci-rp: fix-macos-vendor
docker build . -f Dockerfile.ci-rp --ulimit=nofile=4096:4096 --build-arg REGISTRY=$(REGISTRY) --build-arg ARO_VERSION=$(VERSION) --no-cache=$(NO_CACHE)

ci-clean:
docker image prune --all --filter="label=aro-*=true"

# TODO: hard coding dev-config.yaml is clunky; it is also probably convenient to
# override COMMIT.
deploy:
Expand Down Expand Up @@ -278,4 +281,4 @@ vendor:
install-go-tools:
go install ${GOTESTSUM}

.PHONY: admin.kubeconfig aks.kubeconfig aro az ci-portal ci-rp clean client deploy dev-config.yaml discoverycache fix-macos-vendor generate image-aro-multistage image-fluentbit image-proxy init-contrib lint-go runlocal-rp proxy publish-image-aro-multistage publish-image-fluentbit publish-image-proxy secrets secrets-update e2e.test tunnel test-e2e test-go test-python vendor build-all validate-go unit-test-go coverage-go validate-fips install-go-tools
.PHONY: admin.kubeconfig aks.kubeconfig aro az ci-rp ci-clean clean client deploy dev-config.yaml discoverycache fix-macos-vendor generate image-aro-multistage image-fluentbit image-proxy init-contrib lint-go runlocal-rp proxy publish-image-aro-multistage publish-image-fluentbit publish-image-proxy secrets secrets-update e2e.test tunnel test-e2e test-go test-python vendor build-all validate-go unit-test-go coverage-go validate-fips install-go-tools

0 comments on commit 470884a

Please sign in to comment.