bookreport / Dockerfile
joeraylo's picture
Update Dockerfile
9fa7c37 verified
Raw
History Blame Contribute Delete
653 Bytes
# Use Python 3.9 as the base image
FROM python:3.9
# Create a non-root user for better security
RUN useradd -m -u 1000 user
USER user
# Set environment variables and working directory
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# Copy requirements.txt and install dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy all application files into the container
COPY --chown=user . /app
# Expose port 7860 (required by Hugging Face Spaces)
EXPOSE 7860
# Run FastAPI app with Uvicorn on port 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]