ALYYAN commited on
Commit
89a4662
·
1 Parent(s): 05da41d

req updated

Browse files
Files changed (2) hide show
  1. dockerfile +15 -17
  2. requirements.txt +0 -0
dockerfile CHANGED
@@ -1,29 +1,27 @@
 
1
  FROM python:3.8-slim
2
 
3
- RUN useradd -m -u 1000 user
4
- USER user
5
-
6
  WORKDIR /app
7
 
8
- # Copy requirements first for caching
9
  COPY requirements.txt .
 
 
10
  RUN pip install --no-cache-dir -r requirements.txt
11
 
12
- # Copy all the essential application source code
 
13
  COPY app.py .
14
- COPY src ./src
15
- COPY templates ./templates
16
  COPY static ./static
17
- COPY config ./config
18
- COPY params.yaml .
19
- # ... copy any other essential source files
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
- COPY --chown=user . /app
 
28
  EXPOSE 7860
29
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
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