Spaces / Dockerfile
Idhammz's picture
Update Dockerfile
4c3d711 verified
Raw History Blame Contribute Delete
655 Bytes
# Use the official Python 3.9 image from the Docker Hub
FROM python:3.9
# Create a user and set permissions
RUN useradd -m -u 1000 user
# Set the working directory
WORKDIR /app
# Copy the requirements file and install dependencies
COPY --chown=user requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Force rebuild
RUN echo "Rebuild on $(date)"
# Copy the rest of the application code
COPY --chown=user . .
# Switch to the non-root user
USER user
# Expose the port on which the app will run
EXPOSE 7860
# Command to run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]