From 9320fdf238f5f92685ee7efd899da87b37ec8ffb Mon Sep 17 00:00:00 2001 From: Baerspektivo Date: Thu, 27 Nov 2025 08:33:15 +0100 Subject: [PATCH] REFECTORED: refecotred compose and deploymend --- .gitea/workflows/build-and-deployment.yaml | 28 ++++++++++------------ compose.yaml | 2 +- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/.gitea/workflows/build-and-deployment.yaml b/.gitea/workflows/build-and-deployment.yaml index ea68bcb..236ad96 100644 --- a/.gitea/workflows/build-and-deployment.yaml +++ b/.gitea/workflows/build-and-deployment.yaml @@ -8,6 +8,7 @@ on: - "compose.yaml" - "config/**" - ".gitea/workflows/build-and-deployment.yaml" + - "Dockerfile" workflow_dispatch: jobs: @@ -21,19 +22,21 @@ jobs: run: | mkdir -p ${{ secrets.DEPLOY_PATH }} - - name: Copy compose file - run: cp compose.yaml ${{ secrets.DEPLOY_PATH }} + - name: Copy project files + 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 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 + - name: Build and start containers + run: docker compose up -d --build --force-recreate working-directory: ${{ secrets.DEPLOY_PATH }} - name: Check running containers @@ -42,14 +45,11 @@ jobs: - 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-proxy 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-proxy # Print logs for debugging + docker logs tor-proxy exit 1 fi sleep 5 @@ -58,6 +58,4 @@ jobs: 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" + run: docker exec tor-proxy tor --version || echo "Could not get version" diff --git a/compose.yaml b/compose.yaml index a3cc593..be0a3dc 100644 --- a/compose.yaml +++ b/compose.yaml @@ -2,7 +2,7 @@ services: # Dein Tor Proxy tor: - image: osminogin/tor-simple + image: . container_name: tor-proxy restart: always ports: