-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker_builder.sh
More file actions
executable file
·37 lines (28 loc) · 856 Bytes
/
Copy pathdocker_builder.sh
File metadata and controls
executable file
·37 lines (28 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
scriptdir=$(cd $(dirname $0) && pwd)
workdir="/home/cracker"
image=hashcracker:latest
run() {
echo "$*"
"$@" || exit $?
}
# Build docker image if not exist
if [[ "$(docker image inspect ${image} 2> /dev/null)" == [] ]]; then
run docker build -f ${scriptdir}/tools/docker/Dockerfile . -t hashcracker
fi
main() {
image="hashcracker:latest"
# Default docker arguments
docker_args=(
# Automatically remove the container when it exits
--rm
# Working directory inside the container
--workdir "${workdir}"
# Bind mount a volume. Binds the host directory to the docker.
-v "${scriptdir}:${workdir}"
# Execute the following on container entry
--entrypoint "./build.sh"
)
run docker run "${docker_args[@]}" -it hashcracker:latest
}
main "$@"