2024-10-30 16:24:34 +00:00
|
|
|
name: Create and publish a Docker image
|
|
|
|
|
|
|
|
on:
|
2024-10-31 15:01:13 +00:00
|
|
|
workflow_dispatch:
|
2024-10-30 16:24:34 +00:00
|
|
|
push:
|
2024-10-31 13:09:41 +00:00
|
|
|
tags:
|
2024-11-03 19:28:37 +00:00
|
|
|
- 'v*'
|
2024-10-30 16:24:34 +00:00
|
|
|
|
|
|
|
env:
|
|
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-and-push-image:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
2024-11-03 14:19:12 +00:00
|
|
|
- name: Get version from package.json
|
|
|
|
run: echo "PACKAGE_VERSION=$(jq -r '.version' app/package.json)" >> $GITHUB_ENV
|
|
|
|
|
2024-10-31 14:59:43 +00:00
|
|
|
- name: Log in to GitHub Container Registry
|
2024-10-30 16:24:34 +00:00
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
2024-10-31 14:59:43 +00:00
|
|
|
registry: ghcr.io
|
2024-10-30 16:24:34 +00:00
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2024-10-31 14:59:43 +00:00
|
|
|
- name: Log in to Docker Hub
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
|
|
|
|
2024-10-31 07:10:10 +00:00
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v3.2.0
|
2024-10-31 12:42:38 +00:00
|
|
|
|
2024-10-30 16:24:34 +00:00
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
|
|
|
|
- name: Build and push Docker image
|
|
|
|
uses: docker/build-push-action@v5
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: Dockerfile
|
|
|
|
push: true
|
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
2024-11-03 14:19:12 +00:00
|
|
|
build-args: |
|
|
|
|
PACKAGE_VERSION=${{ env.PACKAGE_VERSION }}
|
2024-10-31 14:59:43 +00:00
|
|
|
tags: |
|
2024-11-03 14:19:12 +00:00
|
|
|
${{ github.repository }}:${{ env.PACKAGE_VERSION }}
|
2024-11-03 18:48:32 +00:00
|
|
|
${{ github.repository }}:latest
|
2024-11-03 14:19:12 +00:00
|
|
|
ghcr.io/${{ github.repository }}:${{ env.PACKAGE_VERSION }}
|
2024-11-03 18:48:32 +00:00
|
|
|
ghcr.io/${{ github.repository }}:latest
|