diff --git a/.forgejo/workflows/build-on-commit.yml b/.forgejo/workflows/build-on-commit.yml index fba6d8f..a4094f5 100644 --- a/.forgejo/workflows/build-on-commit.yml +++ b/.forgejo/workflows/build-on-commit.yml @@ -23,10 +23,6 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - with: - driver: docker-container - driver-opts: | - network=host - name: Login to OCI registry run: | @@ -34,6 +30,7 @@ jobs: - name: Build and push multi-arch Docker images run: | + docker buildx create --use docker buildx build \ --platform linux/amd64,linux/arm64 \ --tag $REPO_HOST/$REPO_PATH:${{ github.sha }} \ @@ -41,7 +38,5 @@ jobs: --push \ . - - name: Cleanup - run: | - docker buildx prune -f - docker logout $REPO_HOST \ No newline at end of file + - name: Remove builder (optional cleanup) + run: docker buildx rm diff --git a/.forgejo/workflows/build-on-tag.yml b/.forgejo/workflows/build-on-tag.yml index 012b946..888102b 100644 --- a/.forgejo/workflows/build-on-tag.yml +++ b/.forgejo/workflows/build-on-tag.yml @@ -18,29 +18,20 @@ jobs: run: | echo "REPO_HOST=$(echo "${{ github.server_url }}" | sed 's~http[s]*://~~g')" >> $GITHUB_ENV echo "REPO_PATH=${{ github.repository }}" >> $GITHUB_ENV - echo "TAG=${{ github.ref_name }}" >> $GITHUB_ENV - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver: docker-container - driver-opts: | - network=host - name: Login to OCI registry run: | echo "${{ secrets.OCI_TOKEN }}" | docker login $REPO_HOST -u "${{ secrets.OCI_USER }}" --password-stdin - - name: Build and push Docker images + - name: Build and push Docker image run: | - docker buildx build \ - --platform linux/amd64,linux/arm64 \ - --tag $REPO_HOST/$REPO_PATH:$TAG \ - --tag $REPO_HOST/$REPO_PATH:latest \ - --push \ - . + TAG=${{ github.ref_name }} # Get the tag name from the context + # Build and push multi-platform Docker images + docker build -t $REPO_HOST/$REPO_PATH:$TAG --push . + # Tag and push latest + docker tag $REPO_HOST/$REPO_PATH:$TAG $REPO_HOST/$REPO_PATH:latest + docker push $REPO_HOST/$REPO_PATH:latest - - name: Cleanup - run: | - docker buildx prune -f - docker logout $REPO_HOST \ No newline at end of file + # Remove the local image to save storage + docker rmi $REPO_HOST/$REPO_PATH:$TAG + docker rmi $REPO_HOST/$REPO_PATH:latest \ No newline at end of file