# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. # ── Build from repo root: ────────────────────────────────────────────────────── # docker build -t meta-env:latest -f envs/Meta_env/server/Dockerfile . # docker run -p 8000:8000 meta-env:latest # ────────────────────────────────────────────────────────────────────────────── FROM python:3.11-slim # Set working directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ curl \ && rm -rf /var/lib/apt/lists/* # Copy requirements first for layer caching COPY server/requirements.txt ./requirements.txt # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy the full project COPY . . # Set Python path so imports work ENV PYTHONPATH=/app ENV PYTHONUNBUFFERED=1 # HF Spaces uses port 7860, local dev uses 8000 # We support both via PORT env variable ENV PORT=7860 EXPOSE 7860 # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://localhost:${PORT}/health || exit 1 # Run the server CMD ["sh", "-c", "uvicorn server.app:app --host 0.0.0.0 --port ${PORT}"]