File tree Expand file tree Collapse file tree 3 files changed +30
-7
lines changed
Expand file tree Collapse file tree 3 files changed +30
-7
lines changed Original file line number Diff line number Diff line change @@ -55,9 +55,15 @@ SSH key must be in PEM format (begins with -----BEGIN RSA PRIVATE KEY-----)
5555
5656The SSH port to be used. Default is 22.
5757
58- # ## `stack_file_name `
58+ # ## `compose_file_path `
5959
60- Docker stack file used. Default is docker-compose.yml
60+ path for Docker compose file used. Default is `docker-compose.yml`(repo root), for example when it's inside a sub-directory `caddy/docker-compose.yml`
61+
62+ # ## `upload_directory`
63+ Uploads docker compose directory, useful when extra files like Configs are needed for the compose project.
64+
65+ # ## `docker_compose_directory`
66+ Specifies which directory in the repository to upload, needed for upload_directory
6167
6268# ## `docker_login_user`
6369
Original file line number Diff line number Diff line change @@ -15,12 +15,18 @@ inputs:
1515 args :
1616 description : Deployment command args.
1717 required : true
18- compose_file_name :
19- description : Docker compose file used. Default is docker-compose.yaml
18+ compose_file_path :
19+ description : path for Docker compose file used. Default is is repo root( docker-compose.yml)
2020 required : false
2121 ssh_port :
2222 description : The ssh port of the server. Default is 22
2323 required : false
24+ upload_directory :
25+ description : when enabled, uploads entire docker directory, useful for configuration files needed along the container
26+ default : ' false'
27+ docker_compose_directory :
28+ description : specifies which directory to upload, needed for upload_directory
29+ required : false
2430 docker_login_password :
2531 description : The docker login password
2632 required : false
Original file line number Diff line number Diff line change @@ -35,15 +35,15 @@ if [ -z "$INPUT_ARGS" ]; then
3535 exit 1
3636fi
3737
38- if [ -z " $INPUT_COMPOSE_FILE_NAME " ]; then
39- INPUT_COMPOSE_FILE_NAME =docker-compose.yml
38+ if [ -z " $INPUT_COMPOSE_FILE_PATH " ]; then
39+ INPUT_COMPOSE_FILE_PATH =docker-compose.yml
4040fi
4141
4242if [ -z " $INPUT_SSH_PORT " ]; then
4343 INPUT_SSH_PORT=22
4444fi
4545
46- COMPOSE_FILE=${INPUT_COMPOSE_FILE_NAME }
46+ COMPOSE_FILE=${INPUT_COMPOSE_FILE_PATH }
4747DOCKER_HOST=ssh://${INPUT_REMOTE_DOCKER_HOST} :${INPUT_SSH_PORT}
4848DEPLOYMENT_COMMAND=" docker compose -f $COMPOSE_FILE "
4949
@@ -77,6 +77,17 @@ echo "Create docker context"
7777docker context create staging --docker " host=ssh://$INPUT_REMOTE_DOCKER_HOST :$INPUT_SSH_PORT "
7878docker context use staging
7979
80+ if $INPUT_UPLOAD_DIRECTORY
81+ then
82+ echo " upload_directory enabled"
83+ if [ -z " $INPUT_DOCKER_COMPOSE_DIRECTORY " ];
84+ then
85+ echo " Input docker_compose_directory is required when upload_directory is enabled!"
86+ exit 1
87+ fi
88+ tar cjvf - -C " $GITHUB_WORKSPACE " " $INPUT_DOCKER_COMPOSE_DIRECTORY " | ssh -o StrictHostKeyChecking=no " $INPUT_REMOTE_DOCKER_HOST " ' tar -xjvf -'
89+ echo " Upload finished"
90+ fi
8091
8192if [ -n " $INPUT_DOCKER_LOGIN_PASSWORD " ] || [ -n " $INPUT_DOCKER_LOGIN_USER " ] || [ -n " $INPUT_DOCKER_LOGIN_REGISTRY " ]; then
8293 echo " Connecting to $INPUT_REMOTE_DOCKER_HOST ... Command: docker login"
You can’t perform that action at this time.
0 commit comments