Skip to content

Add GHCR backend image pipeline and pull-based prod deploy #1

Add GHCR backend image pipeline and pull-based prod deploy

Add GHCR backend image pipeline and pull-based prod deploy #1

name: Build Backend Image
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
packages: write
env:
IMAGE_NAME: zephyr-simulator-server-backend
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set image coordinates
id: vars
run: |
owner="${GITHUB_REPOSITORY_OWNER,,}"
echo "image_repo=ghcr.io/${owner}/${IMAGE_NAME}" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push backend image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ steps.vars.outputs.image_repo }}:latest
${{ steps.vars.outputs.image_repo }}:${{ github.sha }}