diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 04e9f1c..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,80 +0,0 @@ -version: 2.1 - -jobs: - build-amd64: - resource_class: medium - machine: - image: ubuntu-2004:202111-01 - environment: - USER: scholzj - DOCKER_TAG: latest-amd64 - DOCKER_REGISTRY: ghcr.io - steps: - - checkout - - run: - name: Build Docker images - command: make docker_build - - deploy: - name: Login to Docker Hub - command: docker login ghcr.io -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" - - deploy: - name: Push to Docker hub - command: make docker_push - build-arm64: - resource_class: arm.medium - machine: - image: ubuntu-2004:202101-01 - environment: - USER: scholzj - DOCKER_TAG: latest-arm64 - DOCKER_REGISTRY: ghcr.io - steps: - - checkout - - run: - name: Build Docker images - command: make docker_build - - deploy: - name: Login to Docker Hub - command: docker login ghcr.io -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" - - deploy: - name: Push to Docker hub - command: make docker_push - build-manifests: - resource_class: medium - docker: - - image: docker:stable-git - environment: - DOCKER_CLI_EXPERIMENTAL: enabled - DOCKER_BUILDKIT: 1 - steps: - - setup_remote_docker: - version: 20.10.7 - - run: - name: Pull images - command: | - docker pull ghcr.io/scholzj/zoo-entrance:latest-amd64 - docker pull ghcr.io/scholzj/zoo-entrance:latest-arm64 - - run: - name: Create manifest - command: | - docker manifest create ghcr.io/scholzj/zoo-entrance:latest ghcr.io/scholzj/zoo-entrance:latest-amd64 ghcr.io/scholzj/zoo-entrance:latest-arm64 - - deploy: - name: Login to Docker Hub - command: docker login ghcr.io -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" - - deploy: - name: Push manifest - command: | - docker manifest push ghcr.io/scholzj/zoo-entrance:latest - -workflows: - build-workflow: - jobs: - - build-amd64: - context: ghcr.io - - build-arm64: - context: ghcr.io - - build-manifests: - context: ghcr.io - requires: - - build-amd64 - - build-arm64 \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..aa1db23 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,49 @@ +name: Build Kafka Test Apps + +on: + push: + branches: [ "main" ] + +jobs: + build: + name: Build + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + env: + DOCKER_REGISTRY: ghcr.io + DOCKER_ORG: ${{ github.actor }} + DOCKER_TAG: latest + + steps: + # Checkout sources + - uses: actions/checkout@v3 + + # Setup QEMU for multiplatform Docker builds + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + # Setup Docker credentials + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + registry: ${{ env.DOCKER_REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Build the Container images + - name: Build and push the containers for amd64 + run: make docker_build docker_push docker_amend_manifest + env: + DOCKER_ARCHITECTURE: amd64 + - name: Build and push the containers for arm64 + run: make docker_build docker_push docker_amend_manifest + env: + DOCKER_ARCHITECTURE: arm64 + + # Push the container manifest + - name: Push the container manifest + run: make docker_push_manifest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 181a3bb..e1f80db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM quay.io/strimzi/kafka:0.38.0-kafka-3.6.0 +FROM quay.io/strimzi/kafka:0.39.0-kafka-3.6.1 LABEL org.opencontainers.image.source=https://github.com/scholzj/zoo-entrance LABEL org.opencontainers.image.title="Zoo Entrance" diff --git a/Makefile b/Makefile index acff171..7b0ec13 100644 --- a/Makefile +++ b/Makefile @@ -11,16 +11,29 @@ DOCKER_ORG ?= $(USER) DOCKER_IMAGE ?= zoo-entrance DOCKER_TAG ?= latest +ifdef DOCKER_ARCHITECTURE + DOCKER_PLATFORM = --platform linux/$(DOCKER_ARCHITECTURE) + DOCKER_PLATFORM_TAG_SUFFIX = -$(DOCKER_ARCHITECTURE) +endif + all: docker_build docker_push docker_build: - # Build Docker image ... - docker build -t $(DOCKER_ORG)/$(DOCKER_IMAGE):$(DOCKER_TAG) $(DOCKERFILE_DIR) + echo "Building Docker image ..." + docker build --no-cache $(DOCKER_PLATFORM) -t $(DOCKER_ORG)/$(DOCKER_IMAGE):$(DOCKER_TAG)$(DOCKER_PLATFORM_TAG_SUFFIX) $(DOCKERFILE_DIR) docker_tag: - # Tag the $(BUILD_TAG) image we built with the given $(DOCKER_TAG) tag - docker tag $(DOCKER_ORG)/$(DOCKER_IMAGE):$(DOCKER_TAG) $(DOCKER_REGISTRY)/$(DOCKER_ORG)/$(DOCKER_IMAGE):$(DOCKER_TAG) + echo "Tagging $(DOCKER_ORG)/$(DOCKER_IMAGE):$(DOCKER_TAG)$(DOCKER_PLATFORM_TAG_SUFFIX) to $(DOCKER_REGISTRY)/$(DOCKER_ORG)/$(DOCKER_IMAGE):$(DOCKER_TAG)$(DOCKER_PLATFORM_TAG_SUFFIX) ..." + docker tag $(DOCKER_ORG)/$(DOCKER_IMAGE):$(DOCKER_TAG)$(DOCKER_PLATFORM_TAG_SUFFIX) $(DOCKER_REGISTRY)/$(DOCKER_ORG)/$(DOCKER_IMAGE):$(DOCKER_TAG)$(DOCKER_PLATFORM_TAG_SUFFIX) docker_push: docker_tag - # Push the $(DOCKER_TAG)-tagged image to the registry - docker push $(DOCKER_REGISTRY)/$(DOCKER_ORG)/$(DOCKER_IMAGE):$(DOCKER_TAG) + echo "Pushing $(DOCKER_REGISTRY)/$(DOCKER_ORG)/$(DOCKER_IMAGE):$(DOCKER_TAG)$(DOCKER_PLATFORM_TAG_SUFFIX) ..." + docker push $(DOCKER_REGISTRY)/$(DOCKER_ORG)/$(DOCKER_IMAGE):$(DOCKER_TAG)$(DOCKER_PLATFORM_TAG_SUFFIX) + +docker_amend_manifest: + # Create / Amend the manifest + docker manifest create $(DOCKER_REGISTRY)/$(DOCKER_ORG)/$(DOCKER_IMAGE):$(DOCKER_TAG) --amend $(DOCKER_REGISTRY)/$(DOCKER_ORG)/$(DOCKER_IMAGE):$(DOCKER_TAG)$(DOCKER_PLATFORM_TAG_SUFFIX) + +docker_push_manifest: + # Push the manifest to the registry + docker manifest push $(DOCKER_REGISTRY)/$(DOCKER_ORG)/$(DOCKER_IMAGE):$(DOCKER_TAG)