atikur-rabbi commited on
Commit
803c315
·
1 Parent(s): 113accd
Files changed (2) hide show
  1. Dockerfile +16 -1
  2. README.md +7 -1
Dockerfile CHANGED
@@ -23,7 +23,22 @@ RUN cat <<'EOF' > /entrypoint.sh
23
  set -euo pipefail
24
 
25
  cd /workspace
26
- exec dsh web --host 127.0.0.1 --port 7860 --no-open
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  EOF
28
 
29
  RUN chmod +x /entrypoint.sh
 
23
  set -euo pipefail
24
 
25
  cd /workspace
26
+ bind_host="$(hostname -i | awk '{print $1}')"
27
+ if [ -z "$bind_host" ]; then
28
+ echo "Could not determine the container IP address" >&2
29
+ exit 1
30
+ fi
31
+
32
+ args=(web --host "$bind_host" --port 7860 --no-open)
33
+ space_hosts="${HF_SPACE_HOST:-${SPACE_HOST:-}}"
34
+ if [ -n "$space_hosts" ]; then
35
+ IFS=',' read -r -a hosts <<< "$space_hosts"
36
+ args+=(--public-url "https://${hosts[0]}/")
37
+ for host in "${hosts[@]}"; do
38
+ args+=(--trusted-host "$host")
39
+ done
40
+ fi
41
+ exec dsh "${args[@]}"
42
  EOF
43
 
44
  RUN chmod +x /entrypoint.sh
README.md CHANGED
@@ -7,4 +7,10 @@ sdk: docker
7
  pinned: false
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
7
  pinned: false
8
  ---
9
 
10
+ DSH listens on the container IP on port 7860. After the Space starts, open
11
+ the tokenized HTTPS URL printed in the container logs. The token grants access
12
+ to the DSH agent and its workspace: keep the Space private, restrict access to
13
+ its logs, and never share the URL publicly.
14
+
15
+ The launch token changes when DSH restarts. Data under `/data/dsh` and
16
+ `/workspace` is not persistent unless backed by appropriate storage.