Skip to content

Commit b3115ff

Browse files
committed
Update remote command. Transfer archive.
1 parent 3ea98cb commit b3115ff

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

entrypoint.sh

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,28 @@ log() {
55
echo ">> [local]" $@
66
}
77

8-
log "Packing workspace into archive to transfer onto remote machine."
9-
tar cjvf /tmp/workspace.tar.bz2 --exclude .git .
10-
11-
log "Launching ssh agent."
12-
eval `ssh-agent -s`
138
cleanup() {
9+
set +e
1410
log "Killing ssh agent."
1511
ssh-agent -k
12+
log "Removing workspace archive."
13+
rm -f /tmp/workspace.tar.bz2
1614
}
1715
trap cleanup EXIT
1816

17+
log "Packing workspace into archive to transfer onto remote machine."
18+
tar cjvf /tmp/workspace.tar.bz2 --exclude .git .
19+
20+
log "Launching ssh agent."
21+
eval `ssh-agent -s`
22+
1923
ssh-add <(echo "$SSH_PRIVATE_KEY")
2024

2125
remote_command=<< EOF
2226
set -e
2327
2428
log() {
25-
echo ">> [remote]" $@
29+
echo ">> [remote]" \$@
2630
}
2731
2832
cleanup() {
@@ -31,20 +35,21 @@ cleanup() {
3135
}
3236
3337
log "Creating workspace directory..."
34-
mkdir "$$HOME/workspace"
38+
mkdir "\$HOME/workspace"
3539
trap cleanup EXIT
3640
3741
log "Unpacking workspace..."
38-
tar -C "$$HOME/workspace" xjv
42+
tar -C "\$HOME/workspace" xjv
3943
4044
log "Launching docker-compose..."
4145
COMPOSE_PROJECT="$DOCKER_COMPOSE_PREFIX"
4246
COMPOSE_FILENAME="$DOCKER_COMPOSE_FILENAME"
43-
cd $$HOME/workspace
47+
cd \$HOME/workspace
4448
docker-compose up -d
4549
EOF
4650

4751
echo ">> [local] Connecting to remote host."
4852
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
4953
"$SSH_USER@$SSH_HOST" -p "$SSH_PORT" \
50-
"$remote_command"
54+
"$remote_command" \
55+
< /tmp/workspace.tar.bz2

0 commit comments

Comments
 (0)