smart-farm-env / Dockerfile
Andrew2712's picture
Fix Dockerfile app path
f3ff2f8
raw
history blame contribute delete
830 Bytes
# Smart Farm Resource Manager – Root Dockerfile
# Used for Hugging Face Spaces deployment.
# Runs the FastAPI environment server on port 7860.
FROM python:3.11-slim
RUN useradd -m -u 1000 appuser
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the whole project (maintains package structure)
COPY src/ ./src/
COPY pyproject.toml .
# Ensure all intermediate __init__.py files exist
RUN touch src/__init__.py src/envs/__init__.py
RUN chown -R appuser:appuser /app
USER appuser
EXPOSE 7860
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health')"
CMD ["uvicorn", "src.envs.smart_farm_env.server.app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]