saadpie commited on
Commit
d70714b
·
verified ·
1 Parent(s): 0b7d8f5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -64
Dockerfile CHANGED
@@ -2,88 +2,46 @@ FROM ubuntu:22.04
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
5
- # Install essential tools
6
- RUN apt-get update && apt-get install -y \
7
  # Core utilities
8
- wget \
9
- curl \
10
- git \
11
- ca-certificates \
12
- tini \
13
- # Development tools
14
  build-essential \
15
- gcc \
16
- g++ \
17
- make \
18
- cmake \
19
- # Python & pip
20
- python3 \
21
- python3-pip \
22
- python3-venv \
23
- python3-dev \
24
- # Node.js & npm
25
- nodejs \
26
- npm \
27
- # Other useful tools
28
- zip \
29
- unzip \
30
- jq \
31
- tree \
32
- htop \
33
- nano \
34
- vim \
35
  && rm -rf /var/lib/apt/lists/*
36
 
37
- # Download ttyd terminal
38
  RUN ARCH=$(uname -m) && \
39
  if [ "$ARCH" = "x86_64" ]; then DL_ARCH="x86_64"; else DL_ARCH="aarch64"; fi && \
40
  wget -q -O /usr/local/bin/ttyd \
41
  "https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.${DL_ARCH}" && \
42
- chmod +x /usr/local/bin/ttyd && \
43
- /usr/local/bin/ttyd --version
44
 
45
- # Install uv (fast Python package manager)
46
- RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
47
- # Add uv to PATH for all users
48
- echo 'export PATH="/root/.local/bin:$PATH"' >> /root/.bashrc && \
49
- echo 'export PATH="/root/.local/bin:$PATH"' >> /etc/profile
 
50
 
51
- # Install Python 3.11 via uv
52
- RUN /root/.local/bin/uv python install 3.11 && \
53
- /root/.local/bin/uv python pin 3.11 && \
54
- # Install common Python packages
55
- /root/.local/bin/uv pip install \
56
- pip \
57
- setuptools \
58
- wheel \
59
- requests \
60
- httpx \
61
- rich \
62
- typer
63
-
64
- # Create persistent data directory
65
  RUN mkdir -p /data && chmod 777 /data
66
-
67
- # Set working directory
68
  WORKDIR /data
69
 
70
- # Set environment variables
71
- ENV PATH="/root/.local/bin:/usr/local/share/uv/bin:$PATH"
72
- ENV PYTHON_VERSION="3.11"
73
  ENV TERMINAL_PASSWORD="changeme123"
74
-
75
  EXPOSE 7860
76
 
77
  # Health check
78
  HEALTHCHECK --interval=15s --timeout=5s --start-period=30s --retries=3 \
79
  CMD curl -sf -u admin:changeme123 http://localhost:7860/ || exit 1
80
 
 
81
  ENTRYPOINT ["/usr/bin/tini", "--"]
82
-
83
- # Start ttyd with bash
84
- CMD ["/usr/local/bin/ttyd", \
85
- "--writable", \
86
- "--interface", "0.0.0.0", \
87
- "--port", "7860", \
88
- "--credential", "admin:changeme123", \
89
- "bash", "-l"]
 
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
5
+ # Stage 1: Install core tools only (fast)
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
  # Core utilities
8
+ wget curl git ca-certificates tini \
9
+ # Python (system version is fine for most use cases)
10
+ python3 python3-pip python3-venv \
11
+ # Node.js (minimal)
12
+ nodejs npm \
13
+ # Build tools (only if needed for pip/node packages)
14
  build-essential \
15
+ # Useful CLI tools
16
+ jq zip unzip nano \
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  && rm -rf /var/lib/apt/lists/*
18
 
19
+ # Stage 2: Download ttyd
20
  RUN ARCH=$(uname -m) && \
21
  if [ "$ARCH" = "x86_64" ]; then DL_ARCH="x86_64"; else DL_ARCH="aarch64"; fi && \
22
  wget -q -O /usr/local/bin/ttyd \
23
  "https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.${DL_ARCH}" && \
24
+ chmod +x /usr/local/bin/ttyd
 
25
 
26
+ # Stage 3: Install uv (fast Python package manager) + common packages
27
+ RUN curl -LsSf https://astral.sh/uv/install.sh | sh
28
+ ENV PATH="/root/.local/bin:$PATH"
29
+ RUN uv python install 3.11 && \
30
+ uv python pin 3.11 && \
31
+ uv pip install pip setuptools wheel requests httpx rich typer
32
 
33
+ # Stage 4: Setup persistent storage
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  RUN mkdir -p /data && chmod 777 /data
 
 
35
  WORKDIR /data
36
 
37
+ # Environment
 
 
38
  ENV TERMINAL_PASSWORD="changeme123"
 
39
  EXPOSE 7860
40
 
41
  # Health check
42
  HEALTHCHECK --interval=15s --timeout=5s --start-period=30s --retries=3 \
43
  CMD curl -sf -u admin:changeme123 http://localhost:7860/ || exit 1
44
 
45
+ # Start
46
  ENTRYPOINT ["/usr/bin/tini", "--"]
47
+ CMD ["/usr/local/bin/ttyd", "--writable", "--interface", "0.0.0.0", "--port", "7860", "--credential", "admin:changeme123", "bash", "-l"]