Spaces:
Sleeping
Sleeping
File size: 994 Bytes
29d6521 0fe4d83 29d6521 0fe4d83 29d6521 acfb734 0fe4d83 29d6521 56d6a7c 0fe4d83 29d6521 56d6a7c 29d6521 0fe4d83 29d6521 0fe4d83 29d6521 acfb734 | 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 | # Dockerfile for Resource Calculator Project
# Optimized for FastAPI with robust network handling and health checks
FROM python:3.11-slim
# Build arguments for network timeout handling (as per reference)
ARG PIP_DEFAULT_TIMEOUT=1000
ARG PIP_RETRIES=5
# Set environment variables
ENV PIP_DEFAULT_TIMEOUT=${PIP_DEFAULT_TIMEOUT}
ENV PIP_RETRIES=${PIP_RETRIES}
ENV PYTHONUNBUFFERED=1
ENV PORT=8000
# Set working directory
WORKDIR /app
# Copy requirements file
COPY requirements.txt .
# Install Python dependencies in optimized batches (as per reference style)
# Note: Removed OpenCV/YOLO dependencies as they are not needed for this project
RUN pip install --no-cache-dir --timeout=1000 \
-r requirements.txt
# Copy application files explicitly
COPY . .
# Create a non-privileged user for security
RUN useradd -m -u 1000 user
RUN chown -R user:user /app
USER user
# Expose port 8000
EXPOSE 7860
# Run the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |