Spaces:
Paused
Paused
File size: 917 Bytes
93251c1 |
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 |
# Use a specific Python version as the base image
FROM python:3.9
# Create a user with a specific UID and switch to that user
RUN useradd -m -u 1000 user
USER user
# Set the PATH environment variable
ENV PATH="/home/user/.local/bin:$PATH"
# Set the working directory
WORKDIR /app
# Copy and install dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade pip setuptools \
&& pip install --no-cache-dir --upgrade -r requirements.txt
# Copy the rest of the application code
COPY --chown=user . /app
# Define the command to run the Flask application
CMD ["flask", "run", "--host=0.0.0.0", "--port=7860"]
# Optional: Expose the port (not required but good practice)
EXPOSE 7860
# Add a HEALTHCHECK to monitor the server's status
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
|