diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f7e733f..a97e0d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,10 @@ on: release: types: [ published ] +permissions: + contents: read + packages: write + env: PYTHON_VERSION: "3.13" REGISTRY: ghcr.io @@ -130,7 +134,7 @@ jobs: name: Build Docker Image runs-on: ubuntu-latest needs: [test, security] - if: github.event_name == 'push' || github.event_name == 'release' + if: (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop')) || github.event_name == 'release' steps: - name: Checkout code @@ -158,6 +162,16 @@ jobs: type=semver,pattern={{major}}.{{minor}} type=sha,prefix={{branch}}- + - name: Build Docker image (test) + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64 + push: false + tags: test-image:latest + cache-from: type=gha + cache-to: type=gha,mode=max + - name: Build and push Docker image uses: docker/build-push-action@v5 with: @@ -168,6 +182,7 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max + continue-on-error: true deploy-staging: name: Deploy to Staging diff --git a/Dockerfile b/Dockerfile index 3ec7cea..95d956a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # pull official base image -FROM python:3.13-slim-bookworm as builder +FROM python:3.13-slim-bookworm AS builder # set work directory WORKDIR /usr/src/app