Johdw commited on
Commit
20f4351
·
verified ·
1 Parent(s): 5df6fd4

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -3
Dockerfile CHANGED
@@ -1,11 +1,15 @@
1
  # THE FINAL, CORRECT BLUEPRINT.
2
 
3
  FROM python:3.10-slim
 
 
4
  RUN apt-get update && apt-get install -y curl
 
5
  WORKDIR /code
6
 
7
- # THE ARCHITECTURAL FIX: We download the HEAVY, HIGH-QUALITY AI model ONCE,
8
- # during the build. This solves all startup timeout and "Starting..." errors forever.
 
9
  RUN curl -L "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth" -o /tmp/sam_model.pth
10
 
11
  # Install the lightweight Python libraries.
@@ -16,4 +20,4 @@ RUN pip install --no-cache-dir -r /code/requirements.txt
16
  COPY ./main.py /code/main.py
17
 
18
  # The simple, reliable startup command. It starts ONE worker, fixing the memory crash.
19
- CMD ["uvicorn", "main.py:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  # THE FINAL, CORRECT BLUEPRINT.
2
 
3
  FROM python:3.10-slim
4
+
5
+ # Install curl, which we need to download the model during the build.
6
  RUN apt-get update && apt-get install -y curl
7
+
8
  WORKDIR /code
9
 
10
+ # THE ARCHITECTURAL FIX: We download the HEAVY AI model ONCE, during the build.
11
+ # It will be baked into the application. It will never be downloaded at runtime.
12
+ # This solves all startup timeout and "Starting..." errors forever.
13
  RUN curl -L "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth" -o /tmp/sam_model.pth
14
 
15
  # Install the lightweight Python libraries.
 
20
  COPY ./main.py /code/main.py
21
 
22
  # The simple, reliable startup command. It starts ONE worker, fixing the memory crash.
23
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]