Skip to content

Docker Image CI

Docker Image CI #12

Workflow file for this run

name: "Docker Image CI"
on:
workflow_dispatch:
push:
branches: ["main"]
tags: ["v*.*"]
pull_request:
branches: ["main"]
env:
REGISTRY: "docker.io"
IMAGE_NAME: "${{ vars.DOCKERHUB_USERNAME }}/srb2kart-server"
jobs:
build:
runs-on: "ubuntu-latest"
steps:
- name: "Checkout ${{ github.repository }}"
uses: "actions/checkout@v4"
- name: "Set up Docker Buildx"
uses: "docker/setup-buildx-action@v3"
- name: "Log into registry ${{ env.REGISTRY }}"
if: "github.event_name != 'pull_request'"
uses: "docker/login-action@v3"
with:
registry: "${{ env.REGISTRY }}"
username: "${{ vars.DOCKERHUB_USERNAME }}"
password: "${{ secrets.DOCKERHUB_TOKEN }}"
- name: "Extract Docker metadata"
id: "meta"
uses: "docker/metadata-action@v5"
with:
images: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"
- name: "Build the Docker image"
uses: "docker/build-push-action@v6"
with:
push: "${{ github.event_name != 'pull_request' }}"
tags: "${{ steps.meta.outputs.tags }}"
labels: "${{ steps.meta.outputs.labels }}"