forked from vufind-org/vufind
-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathdev-docker.sh
More file actions
executable file
·47 lines (42 loc) · 1.23 KB
/
dev-docker.sh
File metadata and controls
executable file
·47 lines (42 loc) · 1.23 KB
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
#!/bin/sh
#
# Author: Ronja Koistinen <ronja.koistinen@helsinki.fi>
#
# Install socat, docker, docker-compose and docker buildx.
#
# For configuration, fill in:
# * .env (see template in env.sample)
# * local/db_root_passwd.secret
# * ~/.ssh/ssh_config (including the jump sequence to $SOCKS5_PROXY_DST)
#
# Start the environment:
# ./localdev-docker.sh up --build -d
#
# Run arbitrary commands in a running container:
# ./localdev-docker.sh exec <container> <command>
#
# Stop the environment:
# ./localdev-docker.sh down
#
# If you need root to run Docker, launch the script like this:
# ./localdev-docker.sh --sudo <up|down|exec> <etc.>
#
# Also make sure the random user inside the container (www-data group) is able
# to write in this source tree.
set -eu
LISTEN_SOCK=./ssh-auth.sock
SUDO=
if [ "$1" = "--sudo" ]; then
SUDO="sudo"
shift
fi
if [ -e "$LISTEN_SOCK" -a ! -S "$LISTEN_SOCK" ]; then
echo "Error: $LISTEN_SOCK exists but is not a socket" >&2
exit 1
elif [ ! -e "$LISTEN_SOCK" ]; then
# Clone the SSH agent socket to a predictable path we can mount in
# the container
socat -d0 -lf socat.log UNIX-LISTEN:"$LISTEN_SOCK",fork \
UNIX-CONNECT:"$SSH_AUTH_SOCK" &
fi
exec $SUDO docker compose $@