Skip to content

Image auch als cache zur Verfügung stellen #5

Image auch als cache zur Verfügung stellen

Image auch als cache zur Verfügung stellen #5

name: Build Docs
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
build-image:
runs-on: ubuntu-latest
outputs:
image_name: ${{ steps.setImageName.outputs.IMAGE_NAME }}
steps:
- uses: actions/checkout@v4
- name: Set image name
id: setImageName
run: |
echo "IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/docs-toolbox:" >> $GITHUB_OUTPUT
- name: Login to GHCR
run: echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push image
run: |
# Runtime Image
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t ${{ steps.setImageName.outputs.IMAGE_NAME }}:latest \
--push .
# Optional: Cache-Image für nächsten Build
docker buildx build \
--platform linux/amd64,linux/arm64 \
--cache-to=type=registry,ref=${{ steps.setImageName.outputs.IMAGE_NAME }}:cache,mode=max \
--push .