-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo_in_docker
executable file
·62 lines (47 loc) · 2.63 KB
/
demo_in_docker
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
# Safely try out a docker container with skiggety utils installed, to see what it's like
# without affecting your machine
# TODO^2: TEST on windows
THIS_DIR="$(cd "$(dirname $BASH_SOURCE)";pwd)"
SKIGGETY_UTILS_DIR="$THIS_DIR"
. $SKIGGETY_UTILS_DIR/lib/skiggety-utils.bash || exit 1
# TODO^86: make sure (for Zerothlife demo'ing) that we can get through enough of the demo_in_docker script with an alternate $EDITOR
if [ -f /.in_docker_demo ]; then
exit_with_error "You are already in the docker demo."
fi
# TODO: also, use a lock file to ensure you're not accidentally running multiple instances of this
if ! ls installers/.markers/docker.configured_with_* installers/.markers/docker.installed_with_* 2>/dev/null; then
$SKIGGETY_UTILS_DIR/bin/shellask "Make sure Docker is installed and running in the background" || exit_with_error "You didn't set up Docker"
fi
cd $SKIGGETY_UTILS_DIR || exit_with_error "Could not find \$SKIGGETY_UTILS_DIR"
echo 'Building docker image...'
time docker build -t skiggety-utils-box --progress plain . || exit_with_error "docker build failed"
echo '...done building docker image.'
echo
TMP_MARKER_DIR=/tmp/skiggety-utils-demo-installer-markers.pid_$$
rm -rf "$TMP_MARKER_DIR"
mkdir -p "$TMP_MARKER_DIR"
touch "$TMP_MARKER_DIR/.keep" #So it doesn't show as missing in docker
echo
echo
echo
cat todo_report/README_in_color.txt
echo
echo "So here you are in this demo machine with skiggety utils not fully installed yet:"
echo
echo "Run './start' for the full install and introduction. (then run 'exec bash')"
echo " ...or..."
echo "Run 'PWD_BIN/install-skiggety-utils' for the just the full install. (then run 'exec bash')"
echo " ...or..."
echo "Run 'installers/devkit' and any other installers you want to be more selective. You might not even need to run 'exec bash'."
# TODO^5: IMPLEMENT and UNCOMMENT: echo "You can run 'TODO' in another terminal to connect to this container, but the container will stop when this session ends"
# TODO: maybe run it in the background and then tell you how to connect more to it, then connect, then clean up:
# TODO^2: can I set the hostname to something friendly so it appears in the prompt?:
# TODO^3: try using docker compose for this:
CONTAINED_UTILS_DIR="/root/code/skiggety-utils"
docker run --rm -it --entrypoint bash \
-v "${SKIGGETY_UTILS_DIR}:${CONTAINED_UTILS_DIR}" \
-v "${TMP_MARKER_DIR}:${CONTAINED_UTILS_DIR}/installers/.markers" \
skiggety-utils-box
# TODO: run a shell with a helpful intro message in the docker container
# TODO: after you implement this, figure out what the shortest one liner is to both checkout skiggety utils and run this script.