🛠️ action.yml -> Added inputs and logic to copy Docker build context to remote host during deployment
This commit is contained in:
18
action.yml
18
action.yml
@@ -27,6 +27,14 @@ inputs:
|
||||
description: 'Remote temporary directory for deployment files'
|
||||
required: false
|
||||
default: '/tmp'
|
||||
copy_build_context:
|
||||
description: 'Whether to copy Docker build context (Dockerfile and related files) to remote host'
|
||||
required: false
|
||||
default: 'false'
|
||||
build_context_path:
|
||||
description: 'Local path to Docker build context (directory containing Dockerfile)'
|
||||
required: false
|
||||
default: '.'
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
@@ -42,6 +50,8 @@ runs:
|
||||
DEPLOY_FILE="${{ inputs.deploy_file }}"
|
||||
DEPLOY_MODE="${{ inputs.deploy_mode }}"
|
||||
REMOTE_TEMP_DIR="${{ inputs.remote_temp_dir }}/$STACK_NAME"
|
||||
COPY_BUILD_CONTEXT="${{ inputs.copy_build_context }}"
|
||||
BUILD_CONTEXT_PATH="${{ inputs.build_context_path }}"
|
||||
|
||||
echo "🚀 Starting deployment of '$STACK_NAME' to host '$SSH_HOST' using mode '$DEPLOY_MODE'"
|
||||
|
||||
@@ -75,6 +85,14 @@ runs:
|
||||
"$DEPLOY_FILE" \
|
||||
"$SSH_USER@$SSH_HOST:$REMOTE_TEMP_DIR/docker-compose.yml"
|
||||
|
||||
# Optionally copy Docker build context
|
||||
if [ "$COPY_BUILD_CONTEXT" == "true" ]; then
|
||||
echo "📂 DEBUG: Copying Docker build context from '$BUILD_CONTEXT_PATH' to remote host"
|
||||
scp -o StrictHostKeyChecking=no -i "$SSH_KEY_FILE" -r \
|
||||
"$BUILD_CONTEXT_PATH"/* \
|
||||
"$SSH_USER@$SSH_HOST:$REMOTE_TEMP_DIR/"
|
||||
fi
|
||||
|
||||
# Validate docker-compose file remotely before deploying
|
||||
echo "🔍 DEBUG: Validating Docker Compose file remotely"
|
||||
ssh -o StrictHostKeyChecking=no -i "$SSH_KEY_FILE" \
|
||||
|
||||
Reference in New Issue
Block a user