Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
FROM python:3.11-slim | |
# Install curl for healthcheck | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
curl \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Create non-root user and set up home directory | |
RUN useradd -m -u 1000 user \ | |
&& mkdir -p /home/user/.local \ | |
&& chown -R user:user /home/user | |
USER user | |
ENV HOME=/home/user \ | |
PATH=/home/user/.local/bin:$PATH | |
# Set working directory | |
WORKDIR /home/user/app | |
# Copy requirements first to leverage Docker cache | |
COPY --chown=user requirements.txt . | |
# Install dependencies | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy app files | |
COPY --chown=user app.py presidio_helpers.py . | |
# Expose Streamlit port | |
EXPOSE 7860 | |
# Healthcheck | |
HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || exit 1 | |
# Run Streamlit | |
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"] |