Adding script/dock: simplifying testing/packaging
This commit is contained in:
parent
05b4ac08b2
commit
8bdf2d2dbd
30
script/dock
Executable file
30
script/dock
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Usage:
|
||||
# dock <test|alpine|packages> [arg]
|
||||
# dock test: build gh-ost & run unit and integration tests
|
||||
# docker alpine: build and run gh-ost on alpine linux
|
||||
# docker pkg [target-path]: build gh-ost release packages and copy to target path (default path: /tmp/gh-ost-release)
|
||||
|
||||
command="$1"
|
||||
|
||||
case "$command" in
|
||||
"test")
|
||||
docker_target="gh-ost-test"
|
||||
docker build . -f Dockerfile.test -t "${docker_target}" && docker run --rm -it "${docker_target}:latest"
|
||||
;;
|
||||
"alpine")
|
||||
docker_target="gh-ost-alpine"
|
||||
docker build . -f Dockerfile -t "${docker_target}" && docker run --rm -it -p 3000:3000 "${docker_target}:latest"
|
||||
;;
|
||||
"pkg")
|
||||
packages_path="${2:-/tmp/gh-ost-release}"
|
||||
docker_target="gh-ost-packaging"
|
||||
docker build . -f Dockerfile.packaging -t "${docker_target}" && docker run --rm -it -v "${packages_path}:/tmp/pkg" "${docker_target}:latest" bash -c 'find /tmp/gh-ost-release/ -maxdepth 1 -type f | xargs cp -t /tmp/pkg'
|
||||
echo "packages generated on ${packages_path}:"
|
||||
ls -l "${packages_path}"
|
||||
;;
|
||||
*)
|
||||
>&2 echo "Usage: dock dock <test|alpine|packages> [arg]"
|
||||
exit 1
|
||||
esac
|
Loading…
Reference in New Issue
Block a user