saadpie commited on
Commit
e03a76f
·
verified ·
1 Parent(s): 3e3c710

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -3
Dockerfile CHANGED
@@ -2,6 +2,7 @@ FROM ubuntu:22.04
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
 
5
  RUN apt-get update && apt-get install -y \
6
  curl \
7
  git \
@@ -16,20 +17,35 @@ RUN apt-get update && apt-get install -y \
16
  sudo \
17
  wget \
18
  tini \
 
 
19
  && rm -rf /var/lib/apt/lists/*
20
 
 
21
  RUN ARCH=$(uname -m) && \
22
  if [ "$ARCH" = "x86_64" ]; then DOWNLOAD_ARCH="x86_64"; else DOWNLOAD_ARCH="aarch64"; fi && \
23
  wget -O /usr/local/bin/ttyd https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.${DOWNLOAD_ARCH} && \
24
  chmod +x /usr/local/bin/ttyd
25
 
26
- # Create the persistent data directory explicitly just in case
27
  RUN mkdir -p /data && chmod 777 /data
28
 
29
- # Change working directory from /workspace to /data
30
  WORKDIR /data
 
 
31
  ENV TERMINAL_PASSWORD="saadpie_secure_pass"
 
 
32
  EXPOSE 7860
33
 
 
 
 
 
34
  ENTRYPOINT ["/usr/bin/tini", "--"]
35
- CMD ["sh", "-c", "/usr/local/bin/ttyd --writable --port 7860 --credential admin:$TERMINAL_PASSWORD bash"]
 
 
 
 
 
 
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
5
+ # Install dependencies + libwebsockets for ttyd
6
  RUN apt-get update && apt-get install -y \
7
  curl \
8
  git \
 
17
  sudo \
18
  wget \
19
  tini \
20
+ libwebsockets-dev \
21
+ ca-certificates \
22
  && rm -rf /var/lib/apt/lists/*
23
 
24
+ # Download ttyd with architecture detection
25
  RUN ARCH=$(uname -m) && \
26
  if [ "$ARCH" = "x86_64" ]; then DOWNLOAD_ARCH="x86_64"; else DOWNLOAD_ARCH="aarch64"; fi && \
27
  wget -O /usr/local/bin/ttyd https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.${DOWNLOAD_ARCH} && \
28
  chmod +x /usr/local/bin/ttyd
29
 
30
+ # Create persistent data directory
31
  RUN mkdir -p /data && chmod 777 /data
32
 
 
33
  WORKDIR /data
34
+
35
+ # Use envsubst-safe password (avoid special chars) or pass via env at runtime
36
  ENV TERMINAL_PASSWORD="saadpie_secure_pass"
37
+ ENV APP_PORT=7860
38
+
39
  EXPOSE 7860
40
 
41
+ # Health check: verify ttyd is responding
42
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
43
+ CMD curl -f -u admin:${TERMINAL_PASSWORD} http://localhost:${APP_PORT}/ || exit 1
44
+
45
  ENTRYPOINT ["/usr/bin/tini", "--"]
46
+
47
+ # Key fixes:
48
+ # 1. --interface 0.0.0.0 (bind to all interfaces)
49
+ # 2. --port ${APP_PORT} (use env var)
50
+ # 3. Quote credential to handle special chars
51
+ CMD ["sh", "-c", "/usr/local/bin/ttyd --writable --interface 0.0.0.0 --port ${APP_PORT} --credential admin:${TERMINAL_PASSWORD} bash"]