35 lines
1.1 KiB
YAML
35 lines
1.1 KiB
YAML
name: Deploy Next.js via Docker (pnpm)
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# Holt den aktuellen Code automatisch in den Docker-Container des Runners
|
|
- name: Code auschecken
|
|
run: |
|
|
curl -L -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
|
"http://172.17.0.1:3000/api/v1/repos/${{ github.repository }}/archive/main.zip" -o repo.zip
|
|
unzip repo.zip
|
|
mv PsalmTafel/* . 2>/dev/null || mv */* . 2>/dev/null
|
|
rm repo.zip
|
|
|
|
- name: Docker Image bauen und starten
|
|
run: |
|
|
echo "Baue neues Docker-Image für PsalmTafel..."
|
|
docker build -t psalmtafel-app .
|
|
|
|
echo "Stoppe alten Container, falls er existiert..."
|
|
docker stop psalmtafel-container || true
|
|
docker rm psalmtafel-container || true
|
|
|
|
echo "Starte neuen Container auf Port 3000..."
|
|
docker run -d \
|
|
--name psalmtafel-container \
|
|
-p 3000:3000 \
|
|
--restart always \
|
|
psalmtafel-app |