REFECTORED: refecotred compose and deploymend
Some checks failed
Build and Deploy / deploy (push) Failing after 2s
Some checks failed
Build and Deploy / deploy (push) Failing after 2s
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user