Skip to content

feat(prod): production readiness — SLOs, runbooks, drills, and CI har… #2

feat(prod): production readiness — SLOs, runbooks, drills, and CI har…

feat(prod): production readiness — SLOs, runbooks, drills, and CI har… #2

name: Build & Push Docker Image
on:
push:
branches: [main]
tags: ["v*"]
workflow_dispatch:
env:
REGISTRY: docker.io
IMAGE_NAME: swadhinbiswas/opencodehub
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push app image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
- name: Build and push runner image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.runner
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-runner:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-runner:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max