feat: Gitea Actions CI/CD — baut Image und pushed in Registry
Some checks failed
Build & Push Docker Image / build (push) Has been cancelled
Some checks failed
Build & Push Docker Image / build (push) Has been cancelled
This commit is contained in:
35
.gitea/workflows/docker-build.yml
Normal file
35
.gitea/workflows/docker-build.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
name: Build & Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.mischlabs.de
|
||||
username: ${{ secrets.REGISTRY_USER }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and Push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: git.mischlabs.de/mrdiderot/michess:latest
|
||||
build-args: |
|
||||
NEXT_PUBLIC_API_URL=${{ vars.NEXT_PUBLIC_API_URL }}
|
||||
NEXT_PUBLIC_APP_URL=${{ vars.NEXT_PUBLIC_APP_URL }}
|
||||
cache-from: type=registry,ref=git.mischlabs.de/mrdiderot/michess:buildcache
|
||||
cache-to: type=registry,ref=git.mischlabs.de/mrdiderot/michess:buildcache,mode=max
|
||||
@@ -1,28 +1,19 @@
|
||||
services:
|
||||
michess:
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-http://localhost:3001}
|
||||
NEXT_PUBLIC_APP_URL: ${NEXT_PUBLIC_APP_URL:-http://localhost:3000}
|
||||
image: michess:latest
|
||||
image: git.mischlabs.de/mrdiderot/michess:latest
|
||||
container_name: michess
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
# PostgreSQL connection (uses 'db' service below)
|
||||
PGHOST: db
|
||||
PGPORT: 5432
|
||||
PGDATABASE: ${POSTGRES_DB:-michess}
|
||||
PGUSER: ${POSTGRES_USER:-michess}
|
||||
PGPASSWORD: ${POSTGRES_PASSWORD:-changeme}
|
||||
# App config
|
||||
PORT: 3001
|
||||
SESSION_SECRET: ${SESSION_SECRET:-change-this-secret-in-production}
|
||||
CORS_ORIGIN: ${CORS_ORIGIN:-http://localhost:3000}
|
||||
# Admin setup: user with this email gets admin role on startup
|
||||
ADMIN_EMAIL: ${ADMIN_EMAIL:-}
|
||||
# Git update path (used by admin panel update button)
|
||||
APP_DIR: /opt/michess
|
||||
ports:
|
||||
- "${MICHESS_PORT:-3000}:3000"
|
||||
@@ -30,8 +21,6 @@ services:
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- app_pnpm:/opt/michess/.pnpm-store
|
||||
networks:
|
||||
- michess_net
|
||||
|
||||
@@ -56,8 +45,6 @@ services:
|
||||
volumes:
|
||||
postgres_data:
|
||||
driver: local
|
||||
app_pnpm:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
michess_net:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
# MiChess Update-Script
|
||||
# Auf der NAS ausführen um die App auf den neuesten Stand zu bringen
|
||||
# Auf der NAS ausführen um das neueste Image zu laden
|
||||
|
||||
set -e
|
||||
|
||||
@@ -8,20 +8,14 @@ SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
echo "=== MiChess Update ==="
|
||||
echo "Verzeichnis: $SCRIPT_DIR"
|
||||
echo ""
|
||||
|
||||
echo "1. Änderungen aus Git holen..."
|
||||
git pull origin main
|
||||
echo "1. Neues Image aus Registry laden..."
|
||||
docker compose pull michess
|
||||
|
||||
echo ""
|
||||
echo "2. Docker Image neu bauen..."
|
||||
docker compose build michess
|
||||
|
||||
echo ""
|
||||
echo "3. Container neu starten..."
|
||||
echo "2. Container neu starten..."
|
||||
docker compose up -d michess
|
||||
|
||||
echo ""
|
||||
echo "✓ Update abgeschlossen!"
|
||||
echo " Container läuft: $(docker compose ps michess --format 'table {{.Status}}')"
|
||||
echo "Update abgeschlossen!"
|
||||
docker compose ps michess
|
||||
|
||||
Reference in New Issue
Block a user