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:
|
services:
|
||||||
michess:
|
michess:
|
||||||
build:
|
image: git.mischlabs.de/mrdiderot/michess:latest
|
||||||
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
|
|
||||||
container_name: michess
|
container_name: michess
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
# PostgreSQL connection (uses 'db' service below)
|
|
||||||
PGHOST: db
|
PGHOST: db
|
||||||
PGPORT: 5432
|
PGPORT: 5432
|
||||||
PGDATABASE: ${POSTGRES_DB:-michess}
|
PGDATABASE: ${POSTGRES_DB:-michess}
|
||||||
PGUSER: ${POSTGRES_USER:-michess}
|
PGUSER: ${POSTGRES_USER:-michess}
|
||||||
PGPASSWORD: ${POSTGRES_PASSWORD:-changeme}
|
PGPASSWORD: ${POSTGRES_PASSWORD:-changeme}
|
||||||
# App config
|
|
||||||
PORT: 3001
|
PORT: 3001
|
||||||
SESSION_SECRET: ${SESSION_SECRET:-change-this-secret-in-production}
|
SESSION_SECRET: ${SESSION_SECRET:-change-this-secret-in-production}
|
||||||
CORS_ORIGIN: ${CORS_ORIGIN:-http://localhost:3000}
|
CORS_ORIGIN: ${CORS_ORIGIN:-http://localhost:3000}
|
||||||
# Admin setup: user with this email gets admin role on startup
|
|
||||||
ADMIN_EMAIL: ${ADMIN_EMAIL:-}
|
ADMIN_EMAIL: ${ADMIN_EMAIL:-}
|
||||||
# Git update path (used by admin panel update button)
|
|
||||||
APP_DIR: /opt/michess
|
APP_DIR: /opt/michess
|
||||||
ports:
|
ports:
|
||||||
- "${MICHESS_PORT:-3000}:3000"
|
- "${MICHESS_PORT:-3000}:3000"
|
||||||
@@ -30,8 +21,6 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
db:
|
db:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
volumes:
|
|
||||||
- app_pnpm:/opt/michess/.pnpm-store
|
|
||||||
networks:
|
networks:
|
||||||
- michess_net
|
- michess_net
|
||||||
|
|
||||||
@@ -56,8 +45,6 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
driver: local
|
driver: local
|
||||||
app_pnpm:
|
|
||||||
driver: local
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
michess_net:
|
michess_net:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# MiChess Update-Script
|
# 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
|
set -e
|
||||||
|
|
||||||
@@ -8,20 +8,14 @@ SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|||||||
cd "$SCRIPT_DIR"
|
cd "$SCRIPT_DIR"
|
||||||
|
|
||||||
echo "=== MiChess Update ==="
|
echo "=== MiChess Update ==="
|
||||||
echo "Verzeichnis: $SCRIPT_DIR"
|
|
||||||
echo ""
|
echo ""
|
||||||
|
echo "1. Neues Image aus Registry laden..."
|
||||||
echo "1. Änderungen aus Git holen..."
|
docker compose pull michess
|
||||||
git pull origin main
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "2. Docker Image neu bauen..."
|
echo "2. Container neu starten..."
|
||||||
docker compose build michess
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "3. Container neu starten..."
|
|
||||||
docker compose up -d michess
|
docker compose up -d michess
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "✓ Update abgeschlossen!"
|
echo "Update abgeschlossen!"
|
||||||
echo " Container läuft: $(docker compose ps michess --format 'table {{.Status}}')"
|
docker compose ps michess
|
||||||
|
|||||||
Reference in New Issue
Block a user