Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +33 -0
Dockerfile
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11-slim
|
| 2 |
+
|
| 3 |
+
# Install curl for healthcheck (minimal dependency)
|
| 4 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
+
curl \
|
| 6 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 7 |
+
|
| 8 |
+
# Set working directory
|
| 9 |
+
WORKDIR /home/user/app
|
| 10 |
+
|
| 11 |
+
# Create non-root user
|
| 12 |
+
RUN useradd -m -u 1000 user
|
| 13 |
+
USER user
|
| 14 |
+
ENV HOME=/home/user \
|
| 15 |
+
PATH=/home/user/.local/bin:$PATH
|
| 16 |
+
|
| 17 |
+
# Copy requirements first to leverage Docker cache
|
| 18 |
+
COPY --chown=user requirements.txt .
|
| 19 |
+
|
| 20 |
+
# Install dependencies
|
| 21 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 22 |
+
|
| 23 |
+
# Copy app files
|
| 24 |
+
COPY --chown=user app.py presidio_helpers.py .
|
| 25 |
+
|
| 26 |
+
# Expose Streamlit port
|
| 27 |
+
EXPOSE 7860
|
| 28 |
+
|
| 29 |
+
# Healthcheck
|
| 30 |
+
HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || exit 1
|
| 31 |
+
|
| 32 |
+
# Run Streamlit
|
| 33 |
+
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|