Johdw commited on
Commit
fe5ce44
·
verified ·
1 Parent(s): 632c3bd

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -0
Dockerfile ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.
12
+ COPY ./requirements.txt /code/requirements.txt
13
+ RUN pip install --no-cache-dir -r /code/requirements.txt
14
+
15
+ # Copy our API code into the main directory. No sub-folders.
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"]