This commit is contained in:
63
.gitea/workflows/build-and-deployment.yaml
Normal file
63
.gitea/workflows/build-and-deployment.yaml
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
---
|
||||||
|
name: Build and Deploy
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- "compose.yaml"
|
||||||
|
- "config/**"
|
||||||
|
- ".gitea/workflows/build-and-deployment.yaml"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: proxmox
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Ensure directory exists
|
||||||
|
run: |
|
||||||
|
mkdir -p ${{ secrets.DEPLOY_PATH }}
|
||||||
|
|
||||||
|
- name: Copy compose file
|
||||||
|
run: cp compose.yaml ${{ secrets.DEPLOY_PATH }}
|
||||||
|
|
||||||
|
- name: Stop containers
|
||||||
|
run: docker compose down || true
|
||||||
|
working-directory: ${{ secrets.DEPLOY_PATH }}
|
||||||
|
|
||||||
|
- name: Pull latest images
|
||||||
|
run: docker compose pull
|
||||||
|
working-directory: ${{ secrets.DEPLOY_PATH }}
|
||||||
|
|
||||||
|
- name: Start containers with latest image
|
||||||
|
run: docker compose up -d --force-recreate
|
||||||
|
working-directory: ${{ secrets.DEPLOY_PATH }}
|
||||||
|
|
||||||
|
- name: Check running containers
|
||||||
|
run: docker ps
|
||||||
|
|
||||||
|
- name: Wait for container to be healthy
|
||||||
|
run: |
|
||||||
|
echo "Waiting for container to become healthy..."
|
||||||
|
# This loop will wait for up to 5 minutes for the container to report a 'healthy' status.
|
||||||
|
# It checks the status every 5 seconds. If the container doesn't become healthy
|
||||||
|
# within the timeout, the script will exit with an error, failing the workflow.
|
||||||
|
end_time=$(( $(date +%s) + 300 )) # 5 minute timeout
|
||||||
|
while [ "$(docker inspect -f {{.State.Health.Status}} tor 2>/dev/null || echo 'unhealthy')" != "healthy" ]; do
|
||||||
|
if [ $(date +%s) -gt $end_time ]; then
|
||||||
|
echo "Timeout: Container did not become healthy within 5 minutes."
|
||||||
|
docker logs tor # Print logs for debugging
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sleep 5
|
||||||
|
echo "Container not healthy yet. Retrying in 5 seconds..."
|
||||||
|
done
|
||||||
|
echo "Container is healthy! Proceeding with next step."
|
||||||
|
|
||||||
|
- name: Show tor version
|
||||||
|
run: |
|
||||||
|
sleep 5
|
||||||
|
docker exec tor cat /app/package.json | grep version || echo "Could not get version"
|
||||||
18
compose.yaml
Normal file
18
compose.yaml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
services:
|
||||||
|
# Dein Tor Proxy
|
||||||
|
tor:
|
||||||
|
image: osminogin/tor-simple
|
||||||
|
container_name: tor-proxy
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "9050:9050"
|
||||||
|
|
||||||
|
# Der Auto-Updater
|
||||||
|
watchtower:
|
||||||
|
image: containrrr/watchtower
|
||||||
|
container_name: watchtower
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
command: --interval 86400 --cleanup # Prüft alle 24h (86400 sek) und löscht alte Images
|
||||||
Reference in New Issue
Block a user