Spaces:
Sleeping
Sleeping
req updated
Browse files- dockerfile +15 -17
- requirements.txt +0 -0
dockerfile
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
|
|
| 1 |
FROM python:3.8-slim
|
| 2 |
|
| 3 |
-
|
| 4 |
-
USER user
|
| 5 |
-
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
-
# Copy requirements
|
| 9 |
COPY requirements.txt .
|
|
|
|
|
|
|
| 10 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 11 |
|
| 12 |
-
#
|
|
|
|
| 13 |
COPY app.py .
|
| 14 |
-
COPY src ./src
|
| 15 |
-
COPY templates ./templates
|
| 16 |
COPY static ./static
|
| 17 |
-
COPY
|
| 18 |
-
|
| 19 |
-
#
|
| 20 |
-
|
| 21 |
-
# --- CRITICAL CHANGE ---
|
| 22 |
-
# Create a 'model' directory inside the container and
|
| 23 |
-
# copy ONLY our LFS-tracked model file into it.
|
| 24 |
-
COPY --chown=user ./requirements.txt requirements.txt
|
| 25 |
RUN mkdir model
|
| 26 |
COPY artifacts/training/best_model.h5 ./model/
|
| 27 |
-
|
|
|
|
| 28 |
EXPOSE 7860
|
| 29 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
# 1. Use a standard Python base image
|
| 2 |
FROM python:3.8-slim
|
| 3 |
|
| 4 |
+
# 2. Set the working directory
|
|
|
|
|
|
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# 3. Copy ONLY the requirements file to leverage caching
|
| 8 |
COPY requirements.txt .
|
| 9 |
+
|
| 10 |
+
# 4. Install the dependencies
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
|
| 13 |
+
# 5. Selectively copy ONLY the files needed for the APP to RUN.
|
| 14 |
+
# We do NOT copy the whole project.
|
| 15 |
COPY app.py .
|
|
|
|
|
|
|
| 16 |
COPY static ./static
|
| 17 |
+
COPY templates ./templates
|
| 18 |
+
# We need the model, which should be tracked by Git LFS.
|
| 19 |
+
# Create a model directory in the container and copy the model into it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
RUN mkdir model
|
| 21 |
COPY artifacts/training/best_model.h5 ./model/
|
| 22 |
+
|
| 23 |
+
# 6. Expose the port the app runs on
|
| 24 |
EXPOSE 7860
|
| 25 |
+
|
| 26 |
+
# 7. The command to start the production server
|
| 27 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
requirements.txt
CHANGED
|
Binary files a/requirements.txt and b/requirements.txt differ
|
|
|