Skip to content

Commit

Permalink
ci: add container-image.yml
Browse files Browse the repository at this point in the history
for building and pushing container to ghcr.io
  • Loading branch information
pauldotyu committed May 5, 2023
1 parent b0263df commit b601050
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/container-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build and push container image

on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: read
packages: write

# docker buildx to build and push multi-arch images
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Docker Setup Buildx
uses: docker/setup-buildx-action@v2
with:
platforms: linux/amd64,linux/arm64/v8
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- name: Lowercase repo name
id: repository
run: |
echo "LOWERCASE_REPO=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
- name: Build and push using docker Buildx
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/${{ steps.repository.outputs.LOWERCASE_REPO }}:${{ github.sha }},ghcr.io/${{ steps.repository.outputs.LOWERCASE_REPO }}:latest

0 comments on commit b601050

Please sign in to comment.