Skip to content

feat: update abckit to version 0.0.28 and refactor imports in various… #12

feat: update abckit to version 0.0.28 and refactor imports in various…

feat: update abckit to version 0.0.28 and refactor imports in various… #12

name: Build and Push Docker Image
on:
push:
branches:
- main
tags:
- 'v*'
env:
REGISTRY: docker.io
IMAGE_NAME: productdevbook/nitroping
jobs:
build-amd64:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch,suffix=-amd64
type=semver,pattern={{version}},suffix=-amd64
type=semver,pattern={{major}}.{{minor}},suffix=-amd64
type=semver,pattern={{major}},suffix=-amd64
type=raw,value=latest-amd64,enable={{is_default_branch}}
- name: Build and push AMD64 Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
target: production
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=amd64
cache-to: type=gha,mode=max,scope=amd64
build-args: |
DATABASE_URL=postgresql://dummy:dummy@localhost:5432/dummy
JWT_SECRET=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
ENCRYPTION_KEY=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
WEBHOOK_SECRET=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
AUTO_MIGRATE=false
build-arm64:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch,suffix=-arm64
type=semver,pattern={{version}},suffix=-arm64
type=semver,pattern={{major}}.{{minor}},suffix=-arm64
type=semver,pattern={{major}},suffix=-arm64
type=raw,value=latest-arm64,enable={{is_default_branch}}
- name: Build and push ARM64 Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
target: production
platforms: linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=arm64
cache-to: type=gha,mode=max,scope=arm64
build-args: |
DATABASE_URL=postgresql://dummy:dummy@localhost:5432/dummy
JWT_SECRET=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
ENCRYPTION_KEY=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
WEBHOOK_SECRET=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
AUTO_MIGRATE=false
create-manifest:
runs-on: ubuntu-latest
needs: [build-amd64, build-arm64]
permissions:
contents: read
packages: write
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata for manifest
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=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Create and push manifest
run: |
for tag in ${{ steps.meta.outputs.tags }}; do
docker buildx imagetools create \
--tag ${tag} \
${tag}-amd64 \
${tag}-arm64
done