Update Dockerfile
Browse files- Dockerfile +26 -8
Dockerfile
CHANGED
|
@@ -1,16 +1,34 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
RUN curl -fsSL https://code-server.dev/install.sh | sh
|
| 6 |
|
| 7 |
-
#
|
| 8 |
RUN useradd -m -u 1000 user
|
| 9 |
USER user
|
| 10 |
-
ENV HOME=/home/user \
|
| 11 |
-
PATH=/home/user/.local/bin:$PATH
|
| 12 |
-
|
| 13 |
WORKDIR $HOME/app
|
| 14 |
|
| 15 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
CMD ["code-server", "--bind-addr", "0.0.0.0:7860", "--auth", "none", "."]
|
|
|
|
| 1 |
+
# Use Python 3.10 as the base image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
|
| 4 |
+
# Set environment variables
|
| 5 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
+
ENV HOME=/home/user \
|
| 7 |
+
PATH=/home/user/.local/bin:$PATH
|
| 8 |
+
|
| 9 |
+
# 1. Install system dependencies and Node.js (npm)
|
| 10 |
+
RUN apt-get update && apt-get install -y \
|
| 11 |
+
curl \
|
| 12 |
+
git \
|
| 13 |
+
sudo \
|
| 14 |
+
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
| 15 |
+
&& apt-get install -y nodejs \
|
| 16 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
+
|
| 18 |
+
# 2. Install VS Code (code-server)
|
| 19 |
RUN curl -fsSL https://code-server.dev/install.sh | sh
|
| 20 |
|
| 21 |
+
# 3. Create a non-root user for Hugging Face
|
| 22 |
RUN useradd -m -u 1000 user
|
| 23 |
USER user
|
|
|
|
|
|
|
|
|
|
| 24 |
WORKDIR $HOME/app
|
| 25 |
|
| 26 |
+
# 4. Install FastAPI and Uvicorn
|
| 27 |
+
RUN pip install --no-cache-dir fastapi uvicorn
|
| 28 |
+
|
| 29 |
+
# 5. Expose the default Hugging Face port
|
| 30 |
+
EXPOSE 7860
|
| 31 |
+
|
| 32 |
+
# 6. Start code-server
|
| 33 |
+
# We use --auth none for ease of use, but ensure your Space is Private if handling sensitive data.
|
| 34 |
CMD ["code-server", "--bind-addr", "0.0.0.0:7860", "--auth", "none", "."]
|