my-cli / Dockerfile
saadpie's picture
Update Dockerfile
dfa0bd4 verified
Raw
History Blame Contribute Delete
1.29 kB
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
# Minimal deps for ttyd + healthcheck
RUN apt-get update && apt-get install -y \
wget \
curl \
ca-certificates \
libwebsockets15 \
tini \
&& rm -rf /var/lib/apt/lists/*
# Download ttyd static binary
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "x86_64" ]; then DL_ARCH="x86_64"; else DL_ARCH="aarch64"; fi && \
wget -q -O /usr/local/bin/ttyd \
https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.${DL_ARCH} && \
chmod +x /usr/local/bin/ttyd
# ⚠️ HF mounts persistent storage at /data — create it explicitly
RUN mkdir -p /data && chmod 777 /data
WORKDIR /data
# Config
ENV APP_PORT=7860
# Use simple alphanumeric password to avoid shell parsing issues
ENV TERMINAL_PASSWORD="changeme123"
EXPOSE 7860
# Health check so HF knows container is ready
HEALTHCHECK --interval=15s --timeout=5s --start-period=30s --retries=3 \
CMD curl -sf -u admin:${TERMINAL_PASSWORD} http://localhost:${APP_PORT}/ || exit 1
ENTRYPOINT ["/usr/bin/tini", "--"]
# ⚠️ Critical flags: --interface 0.0.0.0 + bind to /data
CMD ["/usr/local/bin/ttyd", \
"--writable", \
"--interface", "0.0.0.0", \
"--port", "${APP_PORT}", \
"--credential", "admin:changeme123", \
"bash"]