Spaces:
Paused
Paused
Rename Dockerfiles to Dockerfile
Browse files- Dockerfile +48 -0
- Dockerfiles +0 -30
Dockerfile
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
| 2 |
+
# you will also find guides on how best to write your Dockerfile
|
| 3 |
+
|
| 4 |
+
FROM python:3.9
|
| 5 |
+
|
| 6 |
+
# Install code-server and other dependencies
|
| 7 |
+
RUN apt-get update && apt-get install -y \
|
| 8 |
+
curl \
|
| 9 |
+
wget \
|
| 10 |
+
git \
|
| 11 |
+
nodejs \
|
| 12 |
+
npm \
|
| 13 |
+
supervisor \
|
| 14 |
+
&& curl -fsSL https://code-server.dev/install.sh | sh \
|
| 15 |
+
&& apt-get clean \
|
| 16 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
+
|
| 18 |
+
RUN useradd -m -u 1000 user
|
| 19 |
+
USER user
|
| 20 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 21 |
+
|
| 22 |
+
WORKDIR /app
|
| 23 |
+
|
| 24 |
+
# Copy requirements and install Python dependencies
|
| 25 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
| 26 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 27 |
+
|
| 28 |
+
# Copy application files
|
| 29 |
+
COPY --chown=user . /app
|
| 30 |
+
|
| 31 |
+
# Create workspace directory for code-server
|
| 32 |
+
RUN mkdir -p /home/user/workspace
|
| 33 |
+
|
| 34 |
+
# Switch to root to set up supervisor
|
| 35 |
+
USER root
|
| 36 |
+
|
| 37 |
+
# Create supervisor configuration
|
| 38 |
+
RUN mkdir -p /etc/supervisor/conf.d
|
| 39 |
+
COPY --chown=root supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
| 40 |
+
|
| 41 |
+
# Switch back to user
|
| 42 |
+
USER user
|
| 43 |
+
|
| 44 |
+
# Expose port 7860 (HF Spaces standard port)
|
| 45 |
+
EXPOSE 7860
|
| 46 |
+
|
| 47 |
+
# Start supervisor which will manage both FastAPI and code-server
|
| 48 |
+
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
Dockerfiles
DELETED
|
@@ -1,30 +0,0 @@
|
|
| 1 |
-
FROM codercom/code-server:latest
|
| 2 |
-
|
| 3 |
-
# Set environment variables to disable authentication
|
| 4 |
-
ENV PASSWORD=""
|
| 5 |
-
ENV DISABLE_TELEMETRY=true
|
| 6 |
-
|
| 7 |
-
# Create a workspace directory
|
| 8 |
-
RUN mkdir -p /workspace
|
| 9 |
-
WORKDIR /workspace
|
| 10 |
-
|
| 11 |
-
# Install additional tools if needed
|
| 12 |
-
USER root
|
| 13 |
-
RUN apt-get update && apt-get install -y \
|
| 14 |
-
git \
|
| 15 |
-
curl \
|
| 16 |
-
wget \
|
| 17 |
-
python3 \
|
| 18 |
-
python3-pip \
|
| 19 |
-
nodejs \
|
| 20 |
-
npm \
|
| 21 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 22 |
-
|
| 23 |
-
# Switch back to coder user
|
| 24 |
-
USER coder
|
| 25 |
-
|
| 26 |
-
# Expose the port that code-server runs on
|
| 27 |
-
EXPOSE 7860
|
| 28 |
-
|
| 29 |
-
# Start code-server with no authentication
|
| 30 |
-
CMD ["code-server", "--bind-addr", "0.0.0.0:7860", "--auth", "none", "--disable-telemetry", "/workspace"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|