Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +57 -13
Dockerfile
CHANGED
|
@@ -2,44 +2,88 @@ FROM ubuntu:22.04
|
|
| 2 |
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 4 |
|
| 5 |
-
# Install
|
| 6 |
RUN apt-get update && apt-get install -y \
|
|
|
|
| 7 |
wget \
|
| 8 |
curl \
|
|
|
|
| 9 |
ca-certificates \
|
| 10 |
tini \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
-
# Download ttyd
|
| 14 |
RUN ARCH=$(uname -m) && \
|
| 15 |
if [ "$ARCH" = "x86_64" ]; then DL_ARCH="x86_64"; else DL_ARCH="aarch64"; fi && \
|
| 16 |
-
wget -q -
|
| 17 |
"https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.${DL_ARCH}" && \
|
| 18 |
chmod +x /usr/local/bin/ttyd && \
|
| 19 |
-
|
| 20 |
-
/usr/local/bin/ttyd --version || exit 1
|
| 21 |
|
| 22 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
RUN mkdir -p /data && chmod 777 /data
|
|
|
|
|
|
|
| 24 |
WORKDIR /data
|
| 25 |
|
| 26 |
-
#
|
| 27 |
-
ENV
|
|
|
|
| 28 |
ENV TERMINAL_PASSWORD="changeme123"
|
| 29 |
|
| 30 |
-
# debug
|
| 31 |
-
|
| 32 |
EXPOSE 7860
|
| 33 |
|
|
|
|
| 34 |
HEALTHCHECK --interval=15s --timeout=5s --start-period=30s --retries=3 \
|
| 35 |
-
CMD curl -sf -u admin:
|
| 36 |
|
| 37 |
ENTRYPOINT ["/usr/bin/tini", "--"]
|
| 38 |
|
| 39 |
-
#
|
| 40 |
CMD ["/usr/local/bin/ttyd", \
|
| 41 |
"--writable", \
|
| 42 |
"--interface", "0.0.0.0", \
|
| 43 |
"--port", "7860", \
|
| 44 |
"--credential", "admin:changeme123", \
|
| 45 |
-
"bash"]
|
|
|
|
| 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"]
|