refactored deployment phase
Some checks failed
Build and Deploy Demo App / test (push) Successful in 11s
Build and Deploy Demo App / build (push) Successful in 7s
Build and Deploy Demo App / scan (push) Successful in 18s
Build and Deploy Demo App / deploy (push) Failing after 47s

This commit is contained in:
2025-11-26 13:39:16 +03:30
parent a8699e2eb4
commit 09af728f80

View File

@@ -84,11 +84,22 @@ jobs:
ssh-add ~/.ssh/id_ed25519
ssh-keyscan -p ${{ secrets.SERVER_PORT }} ${{ secrets.SERVER_HOST }} >> ~/.ssh/known_hosts
- name: Copy tar to server
- name: Copy files to server
run: |
# Copy image tar
scp -o StrictHostKeyChecking=no -P ${{ secrets.SERVER_PORT }} \
demo-app.tar \
${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }}:'${{ secrets.DEPLOY_PATH }}/demo-app.tar'
${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }}:"${{ secrets.DEPLOY_PATH }}/demo-app.tar"
# Copy docker-compose file
scp -o StrictHostKeyChecking=no -P ${{ secrets.SERVER_PORT }} \
docker-compose.yml \
${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }}:"${{ secrets.DEPLOY_PATH }}/docker-compose.yml"
# Copy nginx config directory (used as volume in docker-compose.yml)
scp -o StrictHostKeyChecking=no -P ${{ secrets.SERVER_PORT }} -r \
nginx_user_conf.d \
${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }}:"${{ secrets.DEPLOY_PATH }}/nginx_user_conf.d"
- name: Deploy on server
run: |
@@ -106,9 +117,16 @@ jobs:
# Load the new image from the tarball
docker load -i demo-app.tar
# Make sure we actually have a compose file here
if [ ! -f docker-compose.yml ]; then
echo "ERROR: docker-compose.yml not found in \$(pwd)" >&2
ls -la
exit 1
fi
# Restart the compose stack
docker compose down
docker compose --env-file .env up -d --remove-orphans
docker compose -f docker-compose.yml down
docker compose -f docker-compose.yml --env-file .env up -d --remove-orphans
# Clean up
rm demo-app.tar