Skip to content

Merge pull request #6 from bennjii/lint #112

Merge pull request #6 from bennjii/lint

Merge pull request #6 from bennjii/lint #112

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ "master" ]
release:
types: [ prereleased, released ]
env:
# Github Container registry
REGISTRY: asia-docker.pkg.dev
REGISTRY_PATH: ${{ secrets.GCP_PROJECT_ID }}/open-pos
GCP_REGION: asia
SERVICE_NAME: open-pos
jobs:
build-amd:
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: image=moby/buildkit:buildx-stable-1
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.SERVICE_NAME }}
tags: |
type=ref,event=tag
type=ref,event=branch
type=ref,event=pr
type=raw,value=latest-x86,enable=true
- name: Login to GCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: _json_key
password: ${{ secrets.GAR_JSON_KEY }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-arm:
runs-on: buildjet-4vcpu-ubuntu-2204-arm
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: image=moby/buildkit:buildx-stable-1
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/${{ env.SERVICE_NAME }}
tags: |
type=ref,event=tag,suffix=-arm
type=ref,event=branch,suffix=-arm
type=ref,event=pr,suffix=-arm
type=raw,value=latest-arm,enable=true
- name: Login to GCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: _json_key
password: ${{ secrets.GAR_JSON_KEY }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}