REFECTORED: refecotred compose and deploymend
Some checks failed
Build and Deploy / deploy (push) Failing after 2s

This commit is contained in:
2025-11-27 08:33:15 +01:00
parent 1642bdd08c
commit 9320fdf238
2 changed files with 14 additions and 16 deletions

View File

@@ -8,6 +8,7 @@ on:
- "compose.yaml" - "compose.yaml"
- "config/**" - "config/**"
- ".gitea/workflows/build-and-deployment.yaml" - ".gitea/workflows/build-and-deployment.yaml"
- "Dockerfile"
workflow_dispatch: workflow_dispatch:
jobs: jobs:
@@ -21,19 +22,21 @@ jobs:
run: | run: |
mkdir -p ${{ secrets.DEPLOY_PATH }} mkdir -p ${{ secrets.DEPLOY_PATH }}
- name: Copy compose file - name: Copy project files
run: cp compose.yaml ${{ secrets.DEPLOY_PATH }} run: |
cp compose.yaml ${{ secrets.DEPLOY_PATH }}
cp Dockerfile ${{ secrets.DEPLOY_PATH }}
# Kopiert das config Verzeichnis, falls es existiert
if [ -d "config" ]; then
cp -r config ${{ secrets.DEPLOY_PATH }}
fi
- name: Stop containers - name: Stop containers
run: docker compose down || true run: docker compose down || true
working-directory: ${{ secrets.DEPLOY_PATH }} working-directory: ${{ secrets.DEPLOY_PATH }}
- name: Pull latest images - name: Build and start containers
run: docker compose pull run: docker compose up -d --build --force-recreate
working-directory: ${{ secrets.DEPLOY_PATH }}
- name: Start containers with latest image
run: docker compose up -d --force-recreate
working-directory: ${{ secrets.DEPLOY_PATH }} working-directory: ${{ secrets.DEPLOY_PATH }}
- name: Check running containers - name: Check running containers
@@ -42,14 +45,11 @@ jobs:
- name: Wait for container to be healthy - name: Wait for container to be healthy
run: | run: |
echo "Waiting for container to become healthy..." 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 end_time=$(( $(date +%s) + 300 )) # 5 minute timeout
while [ "$(docker inspect -f {{.State.Health.Status}} tor-proxy 2>/dev/null || echo 'unhealthy')" != "healthy" ]; do while [ "$(docker inspect -f {{.State.Health.Status}} tor-proxy 2>/dev/null || echo 'unhealthy')" != "healthy" ]; do
if [ $(date +%s) -gt $end_time ]; then if [ $(date +%s) -gt $end_time ]; then
echo "Timeout: Container did not become healthy within 5 minutes." echo "Timeout: Container did not become healthy within 5 minutes."
docker logs tor-proxy # Print logs for debugging docker logs tor-proxy
exit 1 exit 1
fi fi
sleep 5 sleep 5
@@ -58,6 +58,4 @@ jobs:
echo "Container is healthy! Proceeding with next step." echo "Container is healthy! Proceeding with next step."
- name: Show tor version - name: Show tor version
run: | run: docker exec tor-proxy tor --version || echo "Could not get version"
sleep 5
docker exec tor cat /app/package.json | grep version || echo "Could not get version"

View File

@@ -2,7 +2,7 @@
services: services:
# Dein Tor Proxy # Dein Tor Proxy
tor: tor:
image: osminogin/tor-simple image: .
container_name: tor-proxy container_name: tor-proxy
restart: always restart: always
ports: ports: