Build & Push Docker Image / test-and-build (push) Successful in 1m38s
Enables re-running the image build without pushing an empty commit. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
54 lines
1.5 KiB
YAML
54 lines
1.5 KiB
YAML
name: Build & Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
REGISTRY: git.sal.giize.com
|
|
IMAGE_NAME: mozempk/insta-recipe
|
|
|
|
jobs:
|
|
test-and-build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Run unit tests
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
target: tester
|
|
push: false
|
|
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
|
|
# read token for the @mozempk/ig-auth scoped registry (npm ci)
|
|
secrets: |
|
|
gitea_npm=${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Log in to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
|
|
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max
|
|
platforms: linux/amd64
|
|
# read token for the @mozempk/ig-auth scoped registry (npm ci)
|
|
secrets: |
|
|
gitea_npm=${{ secrets.REGISTRY_TOKEN }}
|