chore: git ignore /palserver #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow | |
name: Build Docker Image | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_BASENAME: shirok1/palboard | |
jobs: | |
build-and-push: | |
strategy: | |
matrix: | |
context: [frontend, gateway] | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Inspect builder | |
run: | | |
echo "Name: ${{ steps.buildx.outputs.name }}" | |
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" | |
echo "Status: ${{ steps.buildx.outputs.status }}" | |
echo "Flags: ${{ steps.buildx.outputs.flags }}" | |
echo "Platforms: ${{ steps.buildx.outputs.platforms }}" | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_BASENAME }}-${{ matrix.context }} | |
- name: Generate git describe | |
id: git-describe | |
run: tee "VERSION=$(git describe --tags --always --broken)" >> "$GITHUB_OUTPUT" | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./${{ matrix.context }} | |
target: final | |
builder: ${{ steps.buildx.outputs.name }} | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
build-args: | | |
VERSION=${{ steps.git-describe.outputs.VERSION }} | |
- name: Inspect image | |
run: | | |
docker buildx imagetools inspect \ | |
${{ env.REGISTRY }}/${{ env.IMAGE_BASENAME }}-${{ matrix.context }}:${{ steps.meta.outputs.version }} |