Skip to content

Commit 8bdf2d2

Browse files
author
Shlomi Noach
committed
Adding script/dock: simplifying testing/packaging
1 parent 05b4ac0 commit 8bdf2d2

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

script/dock

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
# Usage:
4+
# dock <test|alpine|packages> [arg]
5+
# dock test: build gh-ost & run unit and integration tests
6+
# docker alpine: build and run gh-ost on alpine linux
7+
# docker pkg [target-path]: build gh-ost release packages and copy to target path (default path: /tmp/gh-ost-release)
8+
9+
command="$1"
10+
11+
case "$command" in
12+
"test")
13+
docker_target="gh-ost-test"
14+
docker build . -f Dockerfile.test -t "${docker_target}" && docker run --rm -it "${docker_target}:latest"
15+
;;
16+
"alpine")
17+
docker_target="gh-ost-alpine"
18+
docker build . -f Dockerfile -t "${docker_target}" && docker run --rm -it -p 3000:3000 "${docker_target}:latest"
19+
;;
20+
"pkg")
21+
packages_path="${2:-/tmp/gh-ost-release}"
22+
docker_target="gh-ost-packaging"
23+
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'
24+
echo "packages generated on ${packages_path}:"
25+
ls -l "${packages_path}"
26+
;;
27+
*)
28+
>&2 echo "Usage: dock dock <test|alpine|packages> [arg]"
29+
exit 1
30+
esac

0 commit comments

Comments
 (0)