Migrate workflow to Gitea registry and use pre-built image
Some checks failed
Build & Push Docker Image to Gitea Registry / build-and-push (push) Has been cancelled
Some checks failed
Build & Push Docker Image to Gitea Registry / build-and-push (push) Has been cancelled
This commit is contained in:
@@ -1,11 +1,64 @@
|
|||||||
name: Build & Push Docker Image
|
name: Build & Push Docker Image to Gitea Registry
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: git.mischlabs.de
|
||||||
|
REGISTRY_IMAGE: git.mischlabs.de/mrdiderot/michess
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-and-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Info
|
- name: Checkout
|
||||||
run: echo "Manueller Build-Trigger. Image wird direkt auf der NAS gebaut."
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Docker CLI
|
||||||
|
shell: sh
|
||||||
|
run: |
|
||||||
|
if ! command -v docker >/dev/null 2>&1; then
|
||||||
|
echo "Docker CLI not found. Installing static binary..."
|
||||||
|
if command -v curl >/dev/null 2>&1; then
|
||||||
|
curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-26.1.4.tgz | tar -xz -C /usr/local/bin --strip-components=1 docker/docker
|
||||||
|
elif command -v wget >/dev/null 2>&1; then
|
||||||
|
wget -qO- https://download.docker.com/linux/static/stable/x86_64/docker-26.1.4.tgz | tar -xz -C /usr/local/bin --strip-components=1 docker/docker
|
||||||
|
else
|
||||||
|
echo "Neither curl nor wget found! Attempting package manager install..."
|
||||||
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
|
apt-get update && apt-get install -y docker.io
|
||||||
|
elif command -v apk >/dev/null 2>&1; then
|
||||||
|
apk add --no-cache docker-cli
|
||||||
|
else
|
||||||
|
echo "Cannot install Docker CLI!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Docker CLI already installed."
|
||||||
|
fi
|
||||||
|
docker --version
|
||||||
|
|
||||||
|
- name: Log in to Gitea Package Registry
|
||||||
|
shell: sh
|
||||||
|
run: |
|
||||||
|
if [ -z "${{ secrets.REGISTRY_USER }}" ] || [ -z "${{ secrets.REGISTRY_TOKEN }}" ]; then
|
||||||
|
echo "Missing registry credentials."
|
||||||
|
echo "Create repository secrets REGISTRY_USER and REGISTRY_TOKEN."
|
||||||
|
echo "REGISTRY_TOKEN must be a Gitea access token with package write permission."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "${{ env.REGISTRY }}" -u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
shell: sh
|
||||||
|
run: |
|
||||||
|
docker build \
|
||||||
|
--build-arg NEXT_PUBLIC_API_URL=https://michess-api.mischlabs.de \
|
||||||
|
--build-arg NEXT_PUBLIC_APP_URL=https://michess.mischlabs.de \
|
||||||
|
-t ${{ env.REGISTRY_IMAGE }}:latest \
|
||||||
|
-t ${{ env.REGISTRY_IMAGE }}:${{ github.sha }} \
|
||||||
|
.
|
||||||
|
docker push ${{ env.REGISTRY_IMAGE }}:latest
|
||||||
|
docker push ${{ env.REGISTRY_IMAGE }}:${{ github.sha }}
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
michess:
|
michess:
|
||||||
build:
|
image: git.mischlabs.de/mrdiderot/michess:latest
|
||||||
context: .
|
|
||||||
args:
|
|
||||||
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-https://michess-api.mischlabs.de}
|
|
||||||
NEXT_PUBLIC_APP_URL: ${NEXT_PUBLIC_APP_URL:-https://michess.mischlabs.de}
|
|
||||||
container_name: michess
|
container_name: michess
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
Reference in New Issue
Block a user