From 97e7f7f7560af450ffb21314eef3f30b320dd17d Mon Sep 17 00:00:00 2001 From: Ramkumar Chinchani <45800463+rchincha@users.noreply.github.com> Date: Thu, 10 Nov 2022 12:09:39 -0800 Subject: [PATCH] build: move build artifacts into build/ (#986) Unclutter the root dir by moving all docker/stacker build artifacts into build/ folder. Signed-off-by: Ramkumar Chinchani --- .github/workflows/ci-cd.yml | 8 ++++---- Makefile | 5 +++-- README.md | 2 +- Dockerfile => build/Dockerfile | 0 Dockerfile-conformance => build/Dockerfile-conformance | 0 Dockerfile-minimal => build/Dockerfile-minimal | 0 Dockerfile-zb => build/Dockerfile-zb | 0 Dockerfile-zxp => build/Dockerfile-zxp | 0 .../stacker-conformance.yaml | 4 +++- stacker-zb.yaml => build/stacker-zb.yaml | 4 +++- stacker-zxp.yaml => build/stacker-zxp.yaml | 4 +++- stacker.yaml => build/stacker.yaml | 4 +++- examples/metrics/Makefile | 6 +++--- test/blackbox/annotations.bats | 2 +- 14 files changed, 24 insertions(+), 15 deletions(-) rename Dockerfile => build/Dockerfile (100%) rename Dockerfile-conformance => build/Dockerfile-conformance (100%) rename Dockerfile-minimal => build/Dockerfile-minimal (100%) rename Dockerfile-zb => build/Dockerfile-zb (100%) rename Dockerfile-zxp => build/Dockerfile-zxp (100%) rename stacker-conformance.yaml => build/stacker-conformance.yaml (94%) rename stacker-zb.yaml => build/stacker-zb.yaml (90%) rename stacker-zxp.yaml => build/stacker-zxp.yaml (93%) rename stacker.yaml => build/stacker.yaml (94%) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 4e2277e8..be40bbdf 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -134,7 +134,7 @@ jobs: - name: Build and push zot container image uses: project-stacker/stacker-build-push-action@main with: - file: 'stacker.yaml' + file: 'build/stacker.yaml' build-args: | RELEASE_TAG=${{ github.event.release.tag_name }} COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }} @@ -180,7 +180,7 @@ jobs: - name: Build and push zot-minimal container image uses: project-stacker/stacker-build-push-action@main with: - file: 'stacker.yaml' + file: 'build/stacker.yaml' build-args: | RELEASE_TAG=${{ github.event.release.tag_name }} COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }} @@ -227,7 +227,7 @@ jobs: - name: Build and push zot-exporter container image uses: project-stacker/stacker-build-push-action@main with: - file: 'stacker-zxp.yaml' + file: 'build/stacker-zxp.yaml' build-args: | RELEASE_TAG=${{ github.event.release.tag_name }} COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }} @@ -273,7 +273,7 @@ jobs: - name: Build and push zb container image uses: project-stacker/stacker-build-push-action@main with: - file: 'stacker-zb.yaml' + file: 'build/stacker-zb.yaml' build-args: | RELEASE_TAG=${{ github.event.release.tag_name }} COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }} diff --git a/Makefile b/Makefile index 4a1fb045..0c0916e6 100644 --- a/Makefile +++ b/Makefile @@ -240,7 +240,7 @@ verify-gql-committed: .PHONY: binary-container binary-container: - ${CONTAINER_RUNTIME} build ${BUILD_ARGS} -f Dockerfile -t zot-build:latest . + ${CONTAINER_RUNTIME} build ${BUILD_ARGS} -f build/Dockerfile -t zot-build:latest . .PHONY: run-container run-container: @@ -250,6 +250,7 @@ run-container: .PHONY: binary-stacker binary-stacker: ${STACKER} build \ + -f build/stacker.yaml \ --substitute COMMIT=$(PWD) \ --substitute OS=$(OS) \ --substitute ARCH=$(ARCH) \ @@ -257,7 +258,7 @@ binary-stacker: .PHONY: image image: - ${CONTAINER_RUNTIME} build ${BUILD_ARGS} -f Dockerfile -t zot:latest . + ${CONTAINER_RUNTIME} build ${BUILD_ARGS} -f build/Dockerfile -t zot:latest . $(BATS): rm -rf bats-core; \ diff --git a/README.md b/README.md index fca5e0bd..0f5a5fbb 100644 --- a/README.md +++ b/README.md @@ -125,7 +125,7 @@ Examples of config files are available in [examples/](examples/) dir. # Container Image -The [Dockerfile](./Dockerfile) in this repo can be used to build a container image +The [Dockerfile](./build/Dockerfile) in this repo can be used to build a container image that runs _zot_. To build the image with ref `zot:latest`: diff --git a/Dockerfile b/build/Dockerfile similarity index 100% rename from Dockerfile rename to build/Dockerfile diff --git a/Dockerfile-conformance b/build/Dockerfile-conformance similarity index 100% rename from Dockerfile-conformance rename to build/Dockerfile-conformance diff --git a/Dockerfile-minimal b/build/Dockerfile-minimal similarity index 100% rename from Dockerfile-minimal rename to build/Dockerfile-minimal diff --git a/Dockerfile-zb b/build/Dockerfile-zb similarity index 100% rename from Dockerfile-zb rename to build/Dockerfile-zb diff --git a/Dockerfile-zxp b/build/Dockerfile-zxp similarity index 100% rename from Dockerfile-zxp rename to build/Dockerfile-zxp diff --git a/stacker-conformance.yaml b/build/stacker-conformance.yaml similarity index 94% rename from stacker-conformance.yaml rename to build/stacker-conformance.yaml index 82c24d80..745888b7 100644 --- a/stacker-conformance.yaml +++ b/build/stacker-conformance.yaml @@ -42,9 +42,11 @@ build: build_only: true "${{REPO_NAME:zot}}": + os: ${{OS}} + arch: ${{ARCH}} from: type: docker - url: docker://gcr.io/distroless/base + url: docker://gcr.io/distroless/base:latest-${{ARCH}} overlay_dirs: - source: ./build/binary dest: /usr/local/bin diff --git a/stacker-zb.yaml b/build/stacker-zb.yaml similarity index 90% rename from stacker-zb.yaml rename to build/stacker-zb.yaml index 60cae82f..6448ea63 100644 --- a/stacker-zb.yaml +++ b/build/stacker-zb.yaml @@ -20,9 +20,11 @@ build: build_only: true "${{REPO_NAME:zb}}": + os: ${{OS}} + arch: ${{ARCH}} from: type: docker - url: docker://gcr.io/distroless/base + url: docker://gcr.io/distroless/base:latest-${{ARCH}} overlay_dirs: - source: ./build/binary dest: /usr/local/bin diff --git a/stacker-zxp.yaml b/build/stacker-zxp.yaml similarity index 93% rename from stacker-zxp.yaml rename to build/stacker-zxp.yaml index 20ba1236..fddd2e26 100644 --- a/stacker-zxp.yaml +++ b/build/stacker-zxp.yaml @@ -40,9 +40,11 @@ build: build_only: true "${{REPO_NAME:zxp}}": + os: ${{OS}} + arch: ${{ARCH}} from: type: docker - url: docker://gcr.io/distroless/base + url: docker://gcr.io/distroless/base:latest-${{ARCH}} overlay_dirs: - source: ./build/binary dest: /usr/local/bin diff --git a/stacker.yaml b/build/stacker.yaml similarity index 94% rename from stacker.yaml rename to build/stacker.yaml index 566b9782..81f5a129 100644 --- a/stacker.yaml +++ b/build/stacker.yaml @@ -39,9 +39,11 @@ build: build_only: true "${{REPO_NAME:zot}}": + os: ${{OS}} + arch: ${{ARCH}} from: type: docker - url: docker://gcr.io/distroless/base + url: docker://gcr.io/distroless/base:latest-${{ARCH}} overlay_dirs: - source: ./build/binary dest: /usr/local/bin diff --git a/examples/metrics/Makefile b/examples/metrics/Makefile index 952c6556..2dbe13a9 100644 --- a/examples/metrics/Makefile +++ b/examples/metrics/Makefile @@ -2,7 +2,7 @@ CONTAINER_RUNTIME := docker .PHONY: binary-container binary-container: - ${CONTAINER_RUNTIME} build -f Dockerfile -t zot-build:latest ../../. + ${CONTAINER_RUNTIME} build -f build/Dockerfile -t zot-build:latest ../../. .PHONY: run-container run-container: @@ -11,7 +11,7 @@ run-container: .PHONY: binary-minimal-container binary-minimal-container: - ${CONTAINER_RUNTIME} build -f Dockerfile-minimal -t zot-minimal:latest ../../. + ${CONTAINER_RUNTIME} build -f build/Dockerfile-minimal -t zot-minimal:latest ../../. .PHONY: run-minimal-container run-minimal-container: @@ -20,7 +20,7 @@ run-minimal-container: .PHONY: binary-exporter-container binary-exporter-container: - ${CONTAINER_RUNTIME} build -f Dockerfile-zxp -t zxp:latest ../../. + ${CONTAINER_RUNTIME} build -f build/Dockerfile-zxp -t zxp:latest ../../. .PHONY: run-exporter-container run-exporter-container: diff --git a/test/blackbox/annotations.bats b/test/blackbox/annotations.bats index a350cb24..534e48da 100644 --- a/test/blackbox/annotations.bats +++ b/test/blackbox/annotations.bats @@ -66,7 +66,7 @@ function teardown_file() { } @test "build image with podman and specify annotations" { - run podman build -t 127.0.0.1:8080/annotations:latest . --format oci --annotation org.opencontainers.image.vendor="CentOS" --annotation org.opencontainers.image.licenses="GPLv2" + run podman build -f build/Dockerfile -t 127.0.0.1:8080/annotations:latest . --format oci --annotation org.opencontainers.image.vendor="CentOS" --annotation org.opencontainers.image.licenses="GPLv2" [ "$status" -eq 0 ] run podman push 127.0.0.1:8080/annotations:latest --tls-verify=false --format=oci [ "$status" -eq 0 ]