Skip to content

[CI]: release docker image #5

[CI]: release docker image

[CI]: release docker image #5

Workflow file for this run

name: Build and Push Docker Image
on:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
PROVIDER: ghcr.io
REPO_NAME: ${{ github.repository }}
IMAGE_NAME: ghcr.io/${{ github.repository }}
jobs:
build-and-push:
name: Build and Push Docker Image
runs-on: ubuntu-24.04
if: (github.event_name == 'push' && contains(github.event.head_commit.message, '[CI]')) || (github.event_name == 'workflow_dispatch')
permissions:
contents: read
packages: write
steps:
- name: Checkout Repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
- name: Log in to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # 3.3.0
with:
registry: ${{ env.PROVIDER }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image
run: |
docker buildx build \
--label "org.opencontainers.image.source=https://github.com/${{ env.BASE_IMAGE_NAME }}" \
--label "org.opencontainers.image.created=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
--tag "${{ env.IMAGE_NAME }}:latest" \
--tag "${{ env.IMAGE_NAME }}:${{ github.sha }}" \
--tag "${{ env.IMAGE_NAME }}:${{ github.ref_name }}" \
--push \
--progress=plain \
--file Dockerfile \
.