Spaces:
Sleeping
Sleeping
File size: 1,048 Bytes
c6a4cf3 ff85e7e c6a4cf3 ff85e7e c6a4cf3 ff85e7e c6a4cf3 ff85e7e c6a4cf3 ff85e7e c6a4cf3 ff85e7e c6a4cf3 ff85e7e | 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 32 33 34 | # Use an official lightweight Python image.
FROM python:3.11-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Create a non-root user (Recommended for HF Spaces security permissions)
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
# Set the working directory in the container
WORKDIR /app
# Copy the requirements file first to leverage Docker cache
# Note the --chown flag to ensure the non-root user owns the files
COPY --chown=user ./requirements.txt requirements.txt
# Install dependencies
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy the rest of the application code
COPY --chown=user . /app
# Expose the port strictly required by Hugging Face Spaces
EXPOSE 7860
# Healthcheck updated to check the correct port
HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || exit 1
# Command to run the application
# Note the addition of --server.port=7860
CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0", "--server.port=7860"] |