Spaces:
Sleeping
Sleeping
File size: 1,575 Bytes
a7911d9 65e37e2 a7911d9 65e37e2 a7911d9 65e37e2 a7911d9 65e37e2 a7911d9 65e37e2 a7911d9 65e37e2 a7911d9 65e37e2 a7911d9 65e37e2 a7911d9 65e37e2 a7911d9 65e37e2 a7911d9 65e37e2 a7911d9 65e37e2 | 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 | # 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}"]
|