euler314 commited on
Commit
51a1606
·
verified ·
1 Parent(s): 464dbbd

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -10
Dockerfile CHANGED
@@ -1,25 +1,29 @@
1
- # Use the official HF Spaces base (CPU or GPU as needed)
2
  FROM public.ecr.aws/huggingface/transformers-pytorch-cpu:latest
3
 
4
- # Set working dir
5
- WORKDIR /app
6
 
7
- # Copy your code & requirements
8
- COPY . .
9
 
10
- # Install Python deps
 
 
 
 
11
  RUN pip install --upgrade pip \
12
  && pip install -r requirements.txt \
13
  && pip install huggingface_hub
14
 
15
- # Download Magic-PDF models & write config
16
  RUN wget -q https://raw.githubusercontent.com/Whth/Magic-PDF/master/scripts/download_models_hf.py -O download_models_hf.py \
17
  && python download_models_hf.py \
18
- && mv magic-pdf.json /home/user/ \
19
  && rm download_models_hf.py
20
 
21
- # Expose Gradio port
22
  EXPOSE 7860
23
 
24
- # Launch your app
25
  CMD ["python", "app.py"]
 
1
+ # 1. Start from the official Hugging Face Spaces base
2
  FROM public.ecr.aws/huggingface/transformers-pytorch-cpu:latest
3
 
4
+ # 2. Force HOME to the user dir that runs the app
5
+ ENV HOME=/home/user
6
 
7
+ # 3. Set the working directory under that home
8
+ WORKDIR $HOME/app
9
 
10
+ # 4. Copy code & deps spec
11
+ COPY . $HOME/app
12
+ COPY requirements.txt $HOME/app/requirements.txt
13
+
14
+ # 5. Install everything
15
  RUN pip install --upgrade pip \
16
  && pip install -r requirements.txt \
17
  && pip install huggingface_hub
18
 
19
+ # 6. Download all Magic-PDF models AND emit your magic-pdf.json into $HOME
20
  RUN wget -q https://raw.githubusercontent.com/Whth/Magic-PDF/master/scripts/download_models_hf.py -O download_models_hf.py \
21
  && python download_models_hf.py \
22
+ && mv magic-pdf.json $HOME/ \
23
  && rm download_models_hf.py
24
 
25
+ # 7. Expose Gradio’s default port
26
  EXPOSE 7860
27
 
28
+ # 8. Launch the app
29
  CMD ["python", "app.py"]