run-remote: better directory structure on remote
This commit is contained in:
parent
c312f6a3ff
commit
0ebd17d6f0
1 changed files with 19 additions and 6 deletions
25
run-remote
25
run-remote
|
|
@ -3,11 +3,24 @@
|
||||||
IMAGE="$1"
|
IMAGE="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
TARGET="$1"
|
REMOTE="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
IMAGE_BASENAME=$(basename "${IMAGE}")
|
DIR="/tmp/docker-devtools/infrastructure/${IMAGE}"
|
||||||
docker save -o "/tmp/${IMAGE_BASENAME}" "${IMAGE}"
|
mkdir -p "${DIR}"
|
||||||
rsync -av --progress "/tmp/${IMAGE_BASENAME}" "${IMAGE}/run.sh" "${TARGET}:/tmp"
|
|
||||||
ssh "${TARGET}" docker load -i "/tmp/${IMAGE_BASENAME}"
|
# Save the docker image, transfer it and the per-image run script to remote.
|
||||||
ssh -t "${TARGET}" /tmp/run.sh $@
|
docker save -o "${DIR}/image.tar" "${IMAGE}"
|
||||||
|
cp "${IMAGE}/run.sh" "${DIR}"
|
||||||
|
ssh "${REMOTE}" mkdir -p "docker-devtools/infrastructure/${IMAGE}"
|
||||||
|
rsync -av --progress "${DIR}/" "${REMOTE}:docker-devtools/infrastructure/${IMAGE}"
|
||||||
|
|
||||||
|
# Load docker image on remote.
|
||||||
|
ssh "${REMOTE}" docker load -i "docker-devtools/infrastructure/${IMAGE}/image.tar"
|
||||||
|
|
||||||
|
# Create data dir on remote and run image on remote.
|
||||||
|
ssh -t "${REMOTE}" " \
|
||||||
|
mkdir -p docker-devtools/data/${IMAGE}; \
|
||||||
|
cd docker-devtools/data/${IMAGE}; \
|
||||||
|
\$HOME/docker-devtools/infrastructure/${IMAGE}/run.sh \
|
||||||
|
" $@
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue