Compare commits
11 Commits
1ec01bdf99
...
local
| Author | SHA1 | Date | |
|---|---|---|---|
| 8f3cd35462 | |||
| 7ab8b2997c | |||
| 59b017690d | |||
| 5338247b08 | |||
| b8bb637fb2 | |||
| 5b1e185867 | |||
| e6a76a28ca | |||
| 87349b1fc8 | |||
| e8b7bda08f | |||
| 5e5c5eeda2 | |||
| 45da665ce0 |
10
Dockerfile
10
Dockerfile
@@ -1,8 +1,10 @@
|
||||
FROM alpinelinux/docker-compose
|
||||
FROM docker
|
||||
COPY --from=docker/compose-bin:edge /docker-compose /usr/libexec/docker/cli-plugins/docker-compose
|
||||
RUN docker compose version
|
||||
|
||||
LABEL 'name'='Docker Deployment Action'
|
||||
LABEL 'com.github.actions.name'='Docker Deployment'
|
||||
LABEL 'com.github.actions.description'='supports docker-compose and Docker Swarm deployments'
|
||||
LABEL 'name'='Docker Compose Remote Deployment Action'
|
||||
LABEL 'com.github.actions.name'='Docker Compose Remote Deployment'
|
||||
LABEL 'com.github.actions.description'='supports docker-compose remotely through ssh.'
|
||||
LABEL 'com.github.actions.icon'='send'
|
||||
LABEL 'com.github.actions.color'='green'
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@ inputs:
|
||||
pre_deployment_command_args:
|
||||
description: The args for the pre deploument command.
|
||||
required: false
|
||||
pull_images_first:
|
||||
description: Pull docker images before deploying. Default is false.
|
||||
docker_registry_username:
|
||||
description: The docker registry username.
|
||||
required: false
|
||||
|
||||
@@ -30,7 +30,7 @@ if ! [ -z "${INPUT_DEPLOY_PATH+x}" ] && ! [ -z "$INPUT_DEPLOY_PATH" ]; then
|
||||
echo "Current: `pwd`"
|
||||
echo "Target: $INPUT_DEPLOY_PATH"
|
||||
mkdir -p $INPUT_DEPLOY_PATH
|
||||
cp -rfp ./. $INPUT_DEPLOY_PATH
|
||||
cp -rfp `pwd`/. $INPUT_DEPLOY_PATH
|
||||
cd $INPUT_DEPLOY_PATH
|
||||
fi
|
||||
|
||||
@@ -58,6 +58,7 @@ echo " Port $INPUT_REMOTE_DOCKER_PORT" >> ~/.ssh/config
|
||||
echo " IdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config
|
||||
echo " StrictHostKeyChecking no" >> ~/.ssh/config
|
||||
echo " UserKnownHostsFile /dev/null" >> ~/.ssh/config
|
||||
echo " ConnectTimeout 300" >> ~/.ssh/config
|
||||
if ! [ -z "${INPUT_SSH_PROXY_CMD+x}" ] && ! [ -z "$INPUT_SSH_PROXY_CMD" ]; then
|
||||
echo "Add ProxyCommand: $INPUT_SSH_PROXY_CMD"
|
||||
echo " ProxyCommand $INPUT_SSH_PROXY_CMD" >> ~/.ssh/config
|
||||
@@ -65,6 +66,9 @@ fi
|
||||
echo >> ~/.ssh/config
|
||||
chmod 600 ~/.ssh/config
|
||||
|
||||
docker -v
|
||||
docker compose version
|
||||
|
||||
set context
|
||||
echo "Create docker context"
|
||||
docker context create remote --docker "host=ssh://REMOTE_DOCKER_HOST"
|
||||
@@ -77,7 +81,7 @@ if ! [ -z "${INPUT_DOCKER_REGISTRY_USERNAME+x}" ] && ! [ -z "$INPUT_DOCKER_REGIS
|
||||
fi
|
||||
|
||||
if ! [ -z "${INPUT_DOCKER_PRUNE+x}" ] && [ $INPUT_DOCKER_PRUNE = 'true' ] ; then
|
||||
yes | docker --log-level debug --host "ssh://$INPUT_REMOTE_DOCKER_HOST:$INPUT_REMOTE_DOCKER_PORT" system prune -a 2>&1
|
||||
yes | docker --log-level debug system prune -a 2>&1
|
||||
fi
|
||||
|
||||
DEPLOYMENT_COMMAND="docker --log-level=debug compose"
|
||||
@@ -90,6 +94,14 @@ if ! [ -z "${INPUT_ENV_FILE_NAME+x}" ] && ! [ -z "$INPUT_ENV_FILE_NAME" ]; then
|
||||
DEPLOYMENT_COMMAND="$DEPLOYMENT_COMMAND --env-file ${INPUT_ENV_FILE_NAME//,/ --env-file }"
|
||||
fi
|
||||
|
||||
echo "Connecting to $INPUT_REMOTE_DOCKER_HOST... Command: ${DEPLOYMENT_COMMAND} config"
|
||||
${DEPLOYMENT_COMMAND} "config"
|
||||
|
||||
if ! [ -z "${INPUT_PULL_IMAGES_FIRST+x}" ] && [ $INPUT_PULL_IMAGES_FIRST = 'true' ] ; then
|
||||
echo "Connecting to $INPUT_REMOTE_DOCKER_HOST... Command: ${DEPLOYMENT_COMMAND} pull"
|
||||
${DEPLOYMENT_COMMAND} "pull"
|
||||
fi
|
||||
|
||||
# DEPLOYMENT_COMMAND_OPTIONS=""
|
||||
|
||||
echo "Connecting to $INPUT_REMOTE_DOCKER_HOST... Command: ${DEPLOYMENT_COMMAND} ${INPUT_ARGS}"
|
||||
|
||||
Reference in New Issue
Block a user