Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Code Review Fixes checkpoint: 4 #791

Code Review Fixes checkpoint: 4

Code Review Fixes checkpoint: 4 #791

name: Build Container
on:
push:
paths:
- "src/**"
- "public/**"
- "container/**"
- "package.json"
- "pnpm-lock.yaml"
- ".github/workflows/build-container.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Depot CLI
uses: depot/setup-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Debug secret availability
run: |
if [ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]; then
echo "SECRET IS EMPTY OR NOT SET"
else
echo "SECRET EXISTS (length: ${#TOKEN})"
fi
env:
TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: cvpwb
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta (ghcr)
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=sha
type=raw,value=latest,enable={{is_default_branch}}
- name: Docker meta (dockerhub)
id: meta_dockerhub
# Only push latest on official releases
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/metadata-action@v5
with:
images: |
${{ github.repository }}
tags: |
type=raw,value=latest
type=semver,pattern={{version}},enable=true
- name: Build and push
uses: depot/build-push-action@v1
with:
project: w598sckq92
context: .
file: ./container/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ steps.meta.outputs.tags }}
${{ steps.meta_dockerhub.outputs.tags || '' }}
labels: |
${{ steps.meta.outputs.labels }}
${{ steps.meta_dockerhub.outputs.labels || '' }}