saadpie commited on
Commit
bb92c10
·
verified ·
1 Parent(s): c1cfcb3

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +44 -0
Dockerfile ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:22.04
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 \
9
+ ca-certificates \
10
+ libwebsockets15 \
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"]