diff --git a/.forgejo/workflows/ansible.yml b/.forgejo/workflows/ansible.yml new file mode 100644 index 0000000..24b9317 --- /dev/null +++ b/.forgejo/workflows/ansible.yml @@ -0,0 +1,69 @@ +run-name: Build and Push Ansible Container +on: + push: + branches: + - main + paths: + - 'containers/${{ github.workflow }}/**' + workflow_dispatch: {} + schedule: + - cron: '0 20 * * 5' + +jobs: + build-and-push: + strategy: + matrix: + arch: [ amd64, arm64 ] + runs-on: + - ${{ matrix.arch }} + - docker + container: + image: docker:24-dind + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Builder + uses: docker/setup-buildx-action@v3 + + - name: Login to Forgejo Registry + uses: docker/login-action@v3 + with: + registry: ${{ secrets.CI_REGISTRY }} + username: ${{ secrets.CI_REGISTRY_USER }} + password: ${{ secrets.CI_TOKEN }} + + - name: Set working directory + run: | + cd containers/${{ github.workflow }}/ + shell: bash + + - name: Build and push (${{ matrix.arch }}) + uses: docker/build-push-action@v5 + with: + context: containers/${{ github.workflow }}/ + file: containers/${{ github.workflow }}/Dockerfile + platforms: linux/${{ matrix.arch }} + push: true + tags: | + ${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:${{ matrix.arch }}-latest + + manifest: + needs: build-and-push + runs-on: amd64-docker + container: + image: docker:24-dind + steps: + - name: Login to Forgejo Registry + uses: docker/login-action@v3 + with: + registry: ${{ secrets.CI_REGISTRY }} + username: ${{ secrets.CI_REGISTRY_USER }} + password: ${{ secrets.CI_TOKEN }} + + - name: Create and push multi-arch manifest + run: | + docker manifest create ${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:latest \ + ${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:amd64-latest \ + ${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:arm64-latest + docker manifest push ${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:latest diff --git a/.forgejo/workflows/main.yml b/.forgejo/workflows/main.yml deleted file mode 100644 index c4b0f5c..0000000 --- a/.forgejo/workflows/main.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Build and Push Docker Image - -run-name: Build and Push Docker Image -on: - push: - branches: - - main - workflow_dispatch: {} - schedule: - - cron: '0 20 * * 5' - -jobs: - build-and-push: - # The runner with this label must have Docker installed to be able to run service containers. - runs-on: node - container: - image: docker:24-dind - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Docker Builder - # This action will automatically use the 'dind' service as the build server. - uses: docker/setup-buildx-action@v3 - - - name: Login to Forgejo Registry - uses: docker/login-action@v3 - with: - registry: ${{ secrets.CI_REGISTRY }} - username: ${{ secrets.CI_REGISTRY_USER }} - password: ${{ secrets.CI_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: . - platforms: linux/amd64 - push: true - tags: ${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:latest diff --git a/Dockerfile b/containers/ansible/Dockerfile similarity index 100% rename from Dockerfile rename to containers/ansible/Dockerfile