From 1b7b89ccc6e22c35d2ab9ecf0ef17b1a8deeae7e Mon Sep 17 00:00:00 2001 From: merith-tk Date: Wed, 2 Oct 2024 11:20:38 -0700 Subject: [PATCH] remove push on commit to save on OCI storage --- .forgejo/workflows/build-on-commit.yml | 57 ++++++++++++-------------- 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/.forgejo/workflows/build-on-commit.yml b/.forgejo/workflows/build-on-commit.yml index e18948c..c7cdea7 100644 --- a/.forgejo/workflows/build-on-commit.yml +++ b/.forgejo/workflows/build-on-commit.yml @@ -1,31 +1,26 @@ -name: Build and Publish Docker Image on Commit - -on: - push: - branches: - - main - tags: - - '!' # Exclude tags - -jobs: - build-and-publish: - runs-on: docker-builder - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Test Docker Hello World - run: | - echo "Testing Docker connection..." - docker run hello-world - - - name: Login to OCI registry - run: | - echo "${{ secrets.OCI_TOKEN }}" | docker login git.merith.xyz -u "${{ secrets.OCI_USER }}" --password-stdin - - - name: Build and push Docker image - run: | - REPO=git.merith.xyz/${{ github.repository }} - # Build and push multi-platform Docker images - docker build -t $REPO:${{ github.sha }} --push . +name: Build Docker Image on Commit + +on: + push: + branches: + - main + tags: + - '!' # Exclude tags + +jobs: + build-and-publish: + runs-on: docker-builder + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Build and push Docker image + run: | + REPO=git.merith.xyz/${{ github.repository }} + + # Build Docker image + docker build -t $REPO:${{ github.sha }} . + + # Remove the local image to save storage + docker rmi $REPO:${{ github.sha }}