Skip to content

update ci.yaml

update ci.yaml #3

Workflow file for this run

name: CI/CD for Docker
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to GitHub Container Registry
id: login-ghcr
run: echo ${{ secrets.PAT }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Get the Short Commit SHA
id: get-commit-sha
run: echo "::set-output name=sha_short::$(git rev-parse --short ${{ github.sha }})"
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:${{ steps.get-commit-sha.outputs.sha_short }}
- name: Logout from GitHub Container Registry
run: docker logout ghcr.io