From 01769edd4c61dbf1206a96cad9f0933a8ea89c9f Mon Sep 17 00:00:00 2001 From: Aine Date: Thu, 22 Aug 2024 16:35:41 +0300 Subject: [PATCH] add fresh and stable images --- .github/workflows/workflow.yml | 71 ++++++++++++++++++++++++++++++++++ Dockerfile | 2 +- 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 3f37a59c..1c7c8a9c 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -46,3 +46,74 @@ jobs: ALPINE=${{ env.alpine }} ANSIBLE=${{ env.ansible }} ANSIBLE_CORE=${{ env.ansible_core }} + + build-fresh: + name: Build ansible image (fresh) + needs: build-base + runs-on: self-hosted + if: ${{ github.ref == 'refs/heads/fresh' }} + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to ghcr.io + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/${{ github.repository }} + registry.etke.cc/${{ github.repository }} + tags: | + type=raw,value=fresh,enable=${{ github.ref_name == 'fresh' }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + AGRU=${{ env.agru }} + ALPINE=${{ env.alpine }} + ANSIBLE=${{ env.ansible }} + ANSIBLE_CORE=${{ env.ansible_core }} + + build-stable: + name: Build ansible image (stable) + runs-on: self-hosted + if: ${{ github.ref == 'refs/heads/main' }} + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to ghcr.io + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/${{ github.repository }} + registry.etke.cc/${{ github.repository }} + tags: | + type=raw,value=latest,enable=${{ github.ref_name == 'main' }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + AGRU=${{ env.agru }} + ALPINE=${{ env.alpine }} + ANSIBLE=${{ env.ansible }} + ANSIBLE_CORE=${{ env.ansible_core }} diff --git a/Dockerfile b/Dockerfile index 18570768..71349624 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ARG ALPINE ARG ANSIBLE ARG ANSIBLE_CORE -FROM registry.gitlab.com/etke.cc/ansible/base:${ALPINE}-${ANSIBLE_CORE}-${ANSIBLE} +FROM ghcr.io/etkecc/ansible/base:${ALPINE}-${ANSIBLE_CORE}-${ANSIBLE} ENV AGRU_CLEANUP="-c=false" ENV ANSIBLE_LOG_PATH=" "