fix(deployment): deploy docker-compose files via scp before SSH execution
The previous 'always sync' approach failed because it tried to copy files from /workspace/repo/ which doesn't exist on the production server. The SSH heredoc (<<EOF) executes commands ON the production server, not in the Gitea Actions workspace. File paths inside heredoc are relative to the production server's filesystem. This commit adds an scp step BEFORE the SSH heredoc to transfer docker-compose.base.yml and docker-compose.production.yml from the Actions workspace to the production server. This ensures the build: null overrides (commit2e539ed) reach production and services can restart without build context errors. Changes: - Added scp command to deploy docker-compose files before SSH deployment - Changed file sync check from 'cp' to file existence validation - Updated comments to clarify rsync-based deployment architecture Related commits: -0b342c6: Sequential push strategy -08f6f64: Stable git-SHA IMAGE_TAG -2e539ed: build: null overrides -0db73df: Always-sync docker-compose (incorrect implementation) -3091205: Trigger pipeline with source file change
This commit is contained in:
@@ -1238,6 +1238,17 @@ jobs:
|
||||
echo " Host: ${DEPLOYMENT_HOST}"
|
||||
echo " Stack: ${STACK_PATH}"
|
||||
|
||||
echo "📋 Deploying docker-compose configuration files..."
|
||||
scp -i ~/.ssh/production \
|
||||
-o StrictHostKeyChecking=no \
|
||||
-o UserKnownHostsFile=/dev/null \
|
||||
docker-compose.base.yml docker-compose.production.yml \
|
||||
deploy@${DEPLOYMENT_HOST}:${STACK_PATH}/ || {
|
||||
echo "❌ Failed to deploy docker-compose files"
|
||||
exit 1
|
||||
}
|
||||
echo "✅ Docker Compose files deployed successfully"
|
||||
|
||||
ssh -i ~/.ssh/production \
|
||||
-o StrictHostKeyChecking=no \
|
||||
-o UserKnownHostsFile=/dev/null \
|
||||
@@ -1257,19 +1268,13 @@ jobs:
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Always copy latest docker-compose files from repo to ensure configuration updates are deployed
|
||||
echo "📋 Syncing docker-compose files from repository..."
|
||||
cp /workspace/repo/docker-compose.base.yml . || {
|
||||
echo "❌ Failed to copy docker-compose.base.yml"
|
||||
# Ensure docker-compose files exist (rsync deployment handles this)
|
||||
if [ ! -f docker-compose.base.yml ] || [ ! -f docker-compose.production.yml ]; then
|
||||
echo "❌ Docker Compose files not found in ${STACK_PATH}"
|
||||
echo " Expected files are deployed via rsync in deployment scripts"
|
||||
exit 1
|
||||
}
|
||||
|
||||
cp /workspace/repo/docker-compose.production.yml . || {
|
||||
echo "❌ Failed to copy docker-compose.production.yml"
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "✅ Docker Compose files synced from repository"
|
||||
fi
|
||||
echo "✅ Docker Compose files present in deployment directory"
|
||||
|
||||
echo "📝 Updating docker-compose.production.yml with new image tag..."
|
||||
sed -i "s|image:.*/${IMAGE_NAME}:.*|image: ${FULL_IMAGE}|g" docker-compose.production.yml
|
||||
|
||||
Reference in New Issue
Block a user