-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
39 lines (28 loc) · 836 Bytes
/
Copy pathdocker-entrypoint.sh
File metadata and controls
39 lines (28 loc) · 836 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
38
39
#!/usr/bin/env bash
set -euo pipefail
: "${ELVERN_BIND_HOST:=0.0.0.0}"
: "${ELVERN_PORT:=8000}"
: "${ELVERN_FRONTEND_HOST:=0.0.0.0}"
: "${ELVERN_FRONTEND_PORT:=4173}"
if [[ -n "${ELVERN_DB_PATH:-}" ]]; then
mkdir -p "$(dirname "${ELVERN_DB_PATH}")"
fi
if [[ -n "${ELVERN_TRANSCODE_DIR:-}" ]]; then
mkdir -p "${ELVERN_TRANSCODE_DIR}"
fi
if [[ -n "${ELVERN_HELPER_RELEASES_DIR:-}" ]]; then
mkdir -p "${ELVERN_HELPER_RELEASES_DIR}"
fi
uvicorn backend.app.main:app --host "${ELVERN_BIND_HOST}" --port "${ELVERN_PORT}" &
backend_pid=$!
node frontend/server.mjs &
frontend_pid=$!
shutdown() {
kill "${backend_pid}" "${frontend_pid}" 2>/dev/null || true
}
trap shutdown TERM INT
wait -n "${backend_pid}" "${frontend_pid}"
exit_code=$?
shutdown
wait "${backend_pid}" "${frontend_pid}" 2>/dev/null || true
exit "${exit_code}"