Spaces:
Sleeping
Sleeping
File size: 1,136 Bytes
d63a1ba 61b9118 d63a1ba | 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 | # --- Dockerfile for VulnOps Benchmark ---
FROM python:3.11-slim AS builder
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1
WORKDIR /app
# Install uv for fast dependency management
RUN pip install --no-cache-dir uv
# Copy everything needed to build the module
COPY pyproject.toml uv.lock README.md ./
COPY server/ ./server/
# Install dependencies (without dev)
RUN uv sync --frozen --no-dev --no-editable
# --- Runtime Stage ---
FROM python:3.11-slim
WORKDIR /app
# Copy remaining files
COPY models.py inference.py ./
COPY server/ ./server/
COPY data/ ./data/
# Copy virtualenv from builder
COPY --from=builder /app/.venv /app/.venv
ENV PATH="/app/.venv/bin:$PATH"
# Create non-root user and set permissions for Hugging Face Spaces
RUN useradd -m -u 1000 user && \
mkdir -p /tmp && \
chown -R user:user /app /tmp
USER 1000
# Expose port (HF Spaces defaults to 7860)
EXPOSE 7860
# Default command: Start the environment server
# Use uvicorn to serve the VulnOps FastAPI application on port 7860
CMD ["python", "-m", "uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "7860"]
|