Spaces:
Sleeping
Sleeping
Restore working Streamlit Dockerfile
Browse files- Dockerfile +10 -22
Dockerfile
CHANGED
|
@@ -1,33 +1,21 @@
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
-
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 4 |
-
PYTHONUNBUFFERED=1 \
|
| 5 |
-
TF_CPP_MIN_LOG_LEVEL=2
|
| 6 |
-
|
| 7 |
WORKDIR /app
|
| 8 |
|
| 9 |
-
RUN apt-get update \
|
| 10 |
-
|
|
|
|
|
|
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
-
COPY requirements.txt .
|
|
|
|
|
|
|
| 14 |
|
| 15 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
# Render builds the project from GitHub.
|
| 20 |
-
# The model is not stored on GitHub, so download it from Hugging Face.
|
| 21 |
-
# During a local Docker build, the existing local model is used instead.
|
| 22 |
-
RUN if [ ! -f /app/skin_cancer_model.keras ]; then \
|
| 23 |
-
echo "Downloading model from Hugging Face..." && \
|
| 24 |
-
curl -L --fail --retry 3 \
|
| 25 |
-
-o /app/skin_cancer_model.keras \
|
| 26 |
-
https://huggingface.co/ferides/skin-cancer-classification-model/resolve/main/skin_cancer_model.keras; \
|
| 27 |
-
else \
|
| 28 |
-
echo "Local model file found."; \
|
| 29 |
-
fi
|
| 30 |
|
| 31 |
-
|
| 32 |
|
| 33 |
-
|
|
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
RUN apt-get update && apt-get install -y \
|
| 6 |
+
build-essential \
|
| 7 |
+
curl \
|
| 8 |
+
git \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
+
COPY requirements.txt ./
|
| 12 |
+
COPY src/ ./src/
|
| 13 |
+
COPY skin_cancer_model.keras ./skin_cancer_model.keras
|
| 14 |
|
| 15 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
|
| 17 |
+
EXPOSE 8501
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
+
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
| 20 |
|
| 21 |
+
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false", "--server.enableCORS=false"]
|