preference-lab / Dockerfile
Sibam
fix: ignore dataset download errors during docker build
0123767
Raw
History Blame Contribute Delete
1.21 kB
# PreferenceLab — OpenEnv RLHF Environment
# Hugging Face Spaces compatible Docker image
FROM python:3.10-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy project files
COPY . /app
# Install Python dependencies directly with pip
# Pin versions to match requirements.txt for reproducibility
RUN pip install --no-cache-dir \
"openenv-core>=0.2.1" \
"fastapi>=0.104.0" \
"uvicorn>=0.24.0" \
"pydantic>=2.0.0" \
"openai>=1.0.0" \
"datasets>=2.14.0" \
"httpx>=0.25.0" \
"websockets>=11.0" \
"gradio>=4.0.0" \
"pandas>=2.0.0"
# Environment
ENV PYTHONPATH="/app:$PYTHONPATH"
ENV ENABLE_WEB_INTERFACE=true
ENV MAX_CONCURRENT_ENVS=64
# Health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health')" || exit 1
# Prepare real datasets during build (ignore errors to fallback to synthetic)
RUN python scripts/prepare_datasets.py || true
# Start server
CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "7860"]