Spaces:
Runtime error
Runtime error
File size: 813 Bytes
a53be7e eba3d9e a53be7e eba3d9e a53be7e eba3d9e a53be7e eba3d9e a53be7e eba3d9e a53be7e eba3d9e | 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 | # 1. Use the official Python 3.10 slim image (matches your version)
FROM python:3.10-slim
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# 2. Set the working directory inside the container
WORKDIR $HOME/app
# 3. Copy requirements first (This caches the installation layer)
COPY --chown=user requirements.txt .
# 4. Install dependencies
# --no-cache-dir keeps the image small
RUN pip install --no-cache-dir -r requirements.txt
# 5. Copy the rest of your code
# (The .dockerignore file will stop .env from being copied here)
COPY --chown=user . .
# 6. Expose the app port
EXPOSE 7860
# 7. Run the application
# Use fastapi_app:app (not main:app) and honor Cloud Run PORT if provided
CMD ["uvicorn", "fastapi_app:app", "--host", "0.0.0.0", "--port", "7860"]
|