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