Skip to content

Commit 7fb3aa7

Browse files
authored
Merge pull request #1 from matiasnu/feature/update-docker-compose-to-v2
Update docker compose to v2
2 parents d96d416 + db2cbd8 commit 7fb3aa7

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
## github-action-ssh-docker-compose
2-
Simple github action to run docker-compose on remote host.
2+
Simple github action to run docker compose on remote host.
33

44
This action packs contents of the action workspace into archive.
55
Logs into remote host via ssh. Unpacks the workspace there and runs
6-
`docker-compose up -d` command.
6+
`docker compose up -d` command.
77

88
Comparing to other actions with similar behavior this one does not use any
99
unknown docker-images. It is entirely built from Dockerfile on top of
@@ -18,14 +18,14 @@ unknown docker-images. It is entirely built from Dockerfile on top of
1818
* `ssh_user` - Remote user which should have access to docker.
1919
* `docker_compose_prefix` - Project name passed to compose. Each docker
2020
container will have this prefix in name.
21-
* `docker_compose_filename` - Path to the docker-compose file in the repository.
22-
* `use_stack` - Use docker stack instead of docker-compose.
23-
* `docker_compose_down` - Execute docker-compose-down.
21+
* `docker_compose_filename` - Path to the docker compose file in the repository.
22+
* `use_stack` - Use docker stack instead of docker compose.
23+
* `docker_compose_down` - Execute docker compose-down.
2424

2525
# Usage example
2626

27-
Let's say we have a repo with single docker-compose file in it and remote
28-
ubuntu based server with docker and docker-compose installed.
27+
Let's say we have a repo with single docker compose file in it and remote
28+
ubuntu based server with docker and docker compose installed.
2929

3030
1. Generate key pair, do not use a password here.
3131

@@ -100,7 +100,7 @@ jobs:
100100

101101
In case you want to use some advanced features like secrets. You'll need to
102102
setup a docker swarm cluster and use docker stack command instead of the plain
103-
docker-compose. To do that just set `use_stack` input to `"true"`:
103+
docker compose. To do that just set `use_stack` input to `"true"`:
104104

105105
```
106106
name: Deploy
@@ -125,8 +125,8 @@ jobs:
125125
use_stack: 'true'
126126
```
127127

128-
# Down deploy (Docker-compose down)
129-
If you need to run a docker-compose down to do a clean rollback. Only one down of the
128+
# Down deploy (Docker Compose down)
129+
If you need to run a docker compose down to do a clean rollback. Only one down of the
130130
services will be executed To do that just set `docker_compose_down` input to `"true"`:
131131
```
132132
name: Deploy

action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: SSH-Compose
2-
description: SSH into host and deploy repository with Docker-Compose
2+
description: SSH into host and deploy repository with Docker Compose
33
branding:
44
icon: server
55
color: purple
@@ -18,7 +18,7 @@ inputs:
1818
description: Remote user name.
1919
required: true
2020
docker_compose_prefix:
21-
description: Prefix for docker-compose containers.
21+
description: Prefix for docker compose containers.
2222
required: true
2323
docker_compose_filename:
2424
description: Docker compose file to use
@@ -27,7 +27,7 @@ inputs:
2727
description: Use docker stack instead of docker compose ("true" or "false").
2828
default: 'false'
2929
docker_compose_down:
30-
description: Execute docker-compose-down ("true" or "false").
30+
description: Execute docker compose-down ("true" or "false").
3131
default: 'false'
3232
runs:
3333
using: docker

entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ tar cjvf /tmp/workspace.tar.bz2 --exclude .git --exclude vendor .
2020
log "Launching ssh agent."
2121
eval `ssh-agent -s`
2222

23-
remote_command="set -e ; log() { echo '>> [remote]' \$@ ; } ; cleanup() { log 'Removing workspace...'; rm -rf \"\$HOME/workspace\" ; } ; log 'Creating workspace directory...' ; mkdir -p \"\$HOME/workspace\" ; trap cleanup EXIT ; log 'Unpacking workspace...' ; tar -C \"\$HOME/workspace\" -xjv ; log 'Launching docker-compose...' ; cd \"\$HOME/workspace\" ; docker-compose -f \"$DOCKER_COMPOSE_FILENAME\" -p \"$DOCKER_COMPOSE_PREFIX\" pull ; docker-compose -f \"$DOCKER_COMPOSE_FILENAME\" -p \"$DOCKER_COMPOSE_PREFIX\" up -d --remove-orphans --build"
23+
remote_command="set -e ; log() { echo '>> [remote]' \$@ ; } ; cleanup() { log 'Removing workspace...'; rm -rf \"\$HOME/workspace\" ; } ; log 'Creating workspace directory...' ; mkdir -p \"\$HOME/workspace\" ; trap cleanup EXIT ; log 'Unpacking workspace...' ; tar -C \"\$HOME/workspace\" -xjv ; log 'Launching docker compose...' ; cd \"\$HOME/workspace\" ; docker compose -f \"$DOCKER_COMPOSE_FILENAME\" -p \"$DOCKER_COMPOSE_PREFIX\" pull ; docker compose -f \"$DOCKER_COMPOSE_FILENAME\" -p \"$DOCKER_COMPOSE_PREFIX\" up -d --remove-orphans --build"
2424
if $USE_DOCKER_STACK ; then
2525
remote_command="set -e ; log() { echo '>> [remote]' \$@ ; } ; cleanup() { log 'Removing workspace...'; rm -rf \"\$HOME/workspace\" ; } ; log 'Creating workspace directory...' ; mkdir -p \"\$HOME/workspace/$DOCKER_COMPOSE_PREFIX\" ; trap cleanup EXIT ; log 'Unpacking workspace...' ; tar -C \"\$HOME/workspace/$DOCKER_COMPOSE_PREFIX\" -xjv ; log 'Launching docker stack deploy...' ; cd \"\$HOME/workspace/$DOCKER_COMPOSE_PREFIX\" ; docker stack deploy -c \"$DOCKER_COMPOSE_FILENAME\" --prune \"$DOCKER_COMPOSE_PREFIX\""
2626
fi
2727
if $DOCKER_COMPOSE_DOWN ; then
28-
remote_command="set -e ; log() { echo '>> [remote]' \$@ ; } ; cleanup() { log 'Removing workspace...'; rm -rf \"\$HOME/workspace\" ; } ; log 'Creating workspace directory...' ; mkdir -p \"\$HOME/workspace\" ; trap cleanup EXIT ; log 'Unpacking workspace...' ; tar -C \"\$HOME/workspace\" -xjv ; log 'Launching docker-compose...' ; cd \"\$HOME/workspace\" ; docker-compose -f \"$DOCKER_COMPOSE_FILENAME\" -p \"$DOCKER_COMPOSE_PREFIX\" down"
28+
remote_command="set -e ; log() { echo '>> [remote]' \$@ ; } ; cleanup() { log 'Removing workspace...'; rm -rf \"\$HOME/workspace\" ; } ; log 'Creating workspace directory...' ; mkdir -p \"\$HOME/workspace\" ; trap cleanup EXIT ; log 'Unpacking workspace...' ; tar -C \"\$HOME/workspace\" -xjv ; log 'Launching docker compose...' ; cd \"\$HOME/workspace\" ; docker compose -f \"$DOCKER_COMPOSE_FILENAME\" -p \"$DOCKER_COMPOSE_PREFIX\" down"
2929
fi
3030

3131
ssh-add <(echo "$SSH_PRIVATE_KEY")

0 commit comments

Comments
 (0)