saadpie commited on
Commit
dfa0bd4
·
verified ·
1 Parent(s): aa672e4

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -9
Dockerfile CHANGED
@@ -2,7 +2,7 @@ FROM ubuntu:22.04
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
5
- # Install ONLY what ttyd needs + curl for healthcheck
6
  RUN apt-get update && apt-get install -y \
7
  wget \
8
  curl \
@@ -11,32 +11,34 @@ RUN apt-get update && apt-get install -y \
11
  tini \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # Download ttyd 1.7.7 (static binary, no build needed)
15
  RUN ARCH=$(uname -m) && \
16
  if [ "$ARCH" = "x86_64" ]; then DL_ARCH="x86_64"; else DL_ARCH="aarch64"; fi && \
17
  wget -q -O /usr/local/bin/ttyd \
18
  https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.${DL_ARCH} && \
19
  chmod +x /usr/local/bin/ttyd
20
 
21
- # Persistent storage directory (HF mounts /data automatically)
22
  RUN mkdir -p /data && chmod 777 /data
23
  WORKDIR /data
24
 
25
- # Environment
26
- ENV TERMINAL_PASSWORD="changeme123"
27
  ENV APP_PORT=7860
 
 
28
 
29
  EXPOSE 7860
30
 
31
- # Health check: HF probes this to confirm container is "healthy"
32
- HEALTHCHECK --interval=15s --timeout=5s --start-period=20s --retries=3 \
33
  CMD curl -sf -u admin:${TERMINAL_PASSWORD} http://localhost:${APP_PORT}/ || exit 1
34
 
35
- # Critical: tini as init system + ttyd binding to 0.0.0.0
36
  ENTRYPOINT ["/usr/bin/tini", "--"]
 
 
37
  CMD ["/usr/local/bin/ttyd", \
38
  "--writable", \
39
  "--interface", "0.0.0.0", \
40
- "--port", "7860", \
41
  "--credential", "admin:changeme123", \
42
  "bash"]
 
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
5
+ # Minimal deps for ttyd + healthcheck
6
  RUN apt-get update && apt-get install -y \
7
  wget \
8
  curl \
 
11
  tini \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
+ # Download ttyd static binary
15
  RUN ARCH=$(uname -m) && \
16
  if [ "$ARCH" = "x86_64" ]; then DL_ARCH="x86_64"; else DL_ARCH="aarch64"; fi && \
17
  wget -q -O /usr/local/bin/ttyd \
18
  https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.${DL_ARCH} && \
19
  chmod +x /usr/local/bin/ttyd
20
 
21
+ # ⚠️ HF mounts persistent storage at /data — create it explicitly
22
  RUN mkdir -p /data && chmod 777 /data
23
  WORKDIR /data
24
 
25
+ # Config
 
26
  ENV APP_PORT=7860
27
+ # Use simple alphanumeric password to avoid shell parsing issues
28
+ ENV TERMINAL_PASSWORD="changeme123"
29
 
30
  EXPOSE 7860
31
 
32
+ # Health check so HF knows container is ready
33
+ HEALTHCHECK --interval=15s --timeout=5s --start-period=30s --retries=3 \
34
  CMD curl -sf -u admin:${TERMINAL_PASSWORD} http://localhost:${APP_PORT}/ || exit 1
35
 
 
36
  ENTRYPOINT ["/usr/bin/tini", "--"]
37
+
38
+ # ⚠️ Critical flags: --interface 0.0.0.0 + bind to /data
39
  CMD ["/usr/local/bin/ttyd", \
40
  "--writable", \
41
  "--interface", "0.0.0.0", \
42
+ "--port", "${APP_PORT}", \
43
  "--credential", "admin:changeme123", \
44
  "bash"]