SearchAlgorithms / Dockerfile
Kacemath's picture
Fix: Remove missing websocket import, fix permissions, use Python HTTP server for frontend
5d491ed
raw
history blame contribute delete
951 Bytes
# Simple Hugging Face Spaces Dockerfile
FROM node:20-slim
ENV DEBIAN_FRONTEND=noninteractive
# Install Python
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-venv \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy and build frontend
COPY frontend/package*.json ./frontend/
RUN cd frontend && npm ci
COPY frontend/ ./frontend/
RUN cd frontend && npm run build
# Copy and install backend
COPY backend/ ./backend/
RUN pip3 install --no-cache-dir --break-system-packages \
fastapi uvicorn pydantic pydantic-settings \
httpx psutil python-dotenv websockets
# Simple startup script
COPY start.sh /app/
# Fix permissions for node user
RUN chown -R node:node /app && chmod +x /app/start.sh
# Switch to node user (UID 1000 already exists in node image)
USER node
ENV HOME=/home/node \
PYTHONPATH=/app/backend \
PYTHONUNBUFFERED=1
EXPOSE 7860
CMD ["/app/start.sh"]