forgejo workflow

This commit is contained in:
Julian Krauser 2024-11-16 11:34:39 +01:00
parent 86e36c9c60
commit 254a2d81d9
2 changed files with 84 additions and 0 deletions

View file

@ -0,0 +1,48 @@
on:
workflow_dispatch:
jobs:
build:
runs-on: docker
container:
image: alpine:latest
steps:
- name: install dependencies
run: |
apk add --no-cache git nodejs docker qemu openrc
rc-update add docker default
- name: Wait for Docker daemon
run: |
timeout=300 # Set a timeout value in seconds
until docker info; do
echo "Waiting for Docker daemon to start..."
sleep 5
timeout=$((timeout-5))
if [ $timeout -le 0 ]; then
echo "Timeout waiting for Docker daemon to start."
exit 1
fi
done
- name: checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: "amd64,arm64"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
env:
DOCKER_REGISTRY: docker.registry.jk-effects.cloud
DOCKER_IMAGE_NAME: ehrenamt/member-administration/ui
run: |
docker buildx build \
-t $DOCKER_REGISTRY/$DOCKER_IMAGE_NAME:latest \
--platform linux/amd64,linux/arm64 -f /Dockerfile .
docker push $DOCKER_REGISTRY/$DOCKER_IMAGE_NAME:latest

View file

@ -0,0 +1,36 @@
on:
push:
tags:
- "v*"
jobs:
build:
runs-on: docker
container:
image: docker:dind-rootless
steps:
- name: checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract tag
run: echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Build and push Docker image
env:
DOCKER_REGISTRY: docker.registry.jk-effects.cloud
DOCKER_IMAGE_NAME: ehrenamt/member-administration/ui
TAG: ${{ env.TAG }}
ADDITIONAL_TAG: latest
run: |
docker buildx build \
-t $DOCKER_REGISTRY/$DOCKER_IMAGE_NAME:$TAG \
-t $DOCKER_REGISTRY/$DOCKER_IMAGE_NAME:$ADDITIONAL_TAG \
--platform linux/amd64,linux/arm64 -f /Dockerfile .
docker push $DOCKER_REGISTRY/$DOCKER_IMAGE_NAME:$TAG
docker push $DOCKER_REGISTRY/$DOCKER_IMAGE_NAME:$ADDITIONAL_TAG