-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdev-container
More file actions
executable file
·65 lines (54 loc) · 1.53 KB
/
dev-container
File metadata and controls
executable file
·65 lines (54 loc) · 1.53 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
#
# Start the DCMS stack from inside the VS Code dev container.
# This script discovers the host-resolvable path for the project
# directory so that Docker volume mounts work correctly.
#
set -e
DO_INSTALL=false
while getopts "i" opt; do
case $opt in
i) DO_INSTALL=true
esac
done
# Discover the host path for /projects by inspecting this container's mounts.
# The Docker daemon runs on the host, so volume bind-mounts need host paths,
# not paths as seen from inside this dev container.
CONTAINER_ID=$(hostname)
HOST_PROJECTS=$(sudo docker inspect "$CONTAINER_ID" \
--format '{{range .Mounts}}{{if eq .Destination "/projects"}}{{.Source}}{{end}}{{end}}')
if [ -z "$HOST_PROJECTS" ]; then
echo "ERROR: Could not determine host path for /projects."
echo "Is the Docker socket mounted and accessible?"
exit 1
fi
export PROJECT_DIR="${HOST_PROJECTS}/DCMS"
## Populate env file
cat > "${PWD}/env" <<EOF
APP_DIR=/app
HOME=/data
SECRETS=/app/secrets/secrets.json5
CONFIGFILE=/app/dev.dcfg
SQL_SERVER=db
SQL_DATABASE=dyalog_cms
SQL_USER=dcms
SQL_PASSWORD=apl
SQL_PORT=3306
MYSQL_SERVER=db
MYSQL_DATABASE=dyalog_cms
MYSQL_USER=dcms
MYSQL_PASSWORD=apl
MYSQL_PORT=3306
RIDE_INIT=HTTP:*:4502
MYSQL_RANDOM_ROOT_PASSWORD=1
EOF
echo "PROJECT_DIR: $PROJECT_DIR"
sudo -E docker compose pull
if [ "$DO_INSTALL" = true ]; then
sudo -E docker compose up --exit-code-from install install
if [ $? -ne 0 ]; then
echo "ERROR: Install failed. Not starting services."
exit 1
fi
fi
sudo -E docker compose up web db