All checks were successful
Build and Push Image / docker-build-and-push (push) Successful in 6m2s
51 lines
1.5 KiB
YAML
51 lines
1.5 KiB
YAML
name: Build and Push Image
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
REGISTRY_HOST: registry.campbellwireless.net
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
jobs:
|
|
docker-build-and-push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
git init
|
|
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git"
|
|
git config http.extraheader "Authorization: Basic $(printf '%s' '${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}' | base64)"
|
|
git fetch --depth=1 origin "${{ github.sha }}"
|
|
git checkout FETCH_HEAD
|
|
|
|
- name: Compute image tags
|
|
id: tags
|
|
run: echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY_HOST }}
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
push: true
|
|
platforms: linux/amd64,linux/arm64
|
|
tags: |
|
|
${{ env.REGISTRY_HOST }}/${{ env.IMAGE_NAME }}:latest
|
|
${{ env.REGISTRY_HOST }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.sha_short }}
|