diff --git a/.github/workflows/test-build-image.yml b/.github/workflows/test-build-image.yml new file mode 100644 index 000000000..22e013a0d --- /dev/null +++ b/.github/workflows/test-build-image.yml @@ -0,0 +1,46 @@ +name: Test Build Image + +on: + pull_request: + branches: ["main"] + paths: + - 'backend/**' + +jobs: + build: + name: Build Docker Image + runs-on: ubuntu-latest + strategy: + matrix: + platform: [linux/amd64, linux/arm64] + + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + + - name: Login to GitHub Container Registry + uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3 + + - name: Create Docker Cacha Storage Backend + run: | + docker buildx create --use --driver=docker-container + + - name: Build image + id: build-image + uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5 + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + IMAGE_TAG: ${{ github.sha }} + with: + context: ./backend/ + platforms: ${{ matrix.platform }} + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file