magic-pdf / Dockerfile
euler314's picture
Update Dockerfile
51a1606 verified
Raw
History Blame Contribute Delete
882 Bytes
# 1. Start from the official Hugging Face Spaces base
FROM public.ecr.aws/huggingface/transformers-pytorch-cpu:latest
# 2. Force HOME to the user dir that runs the app
ENV HOME=/home/user
# 3. Set the working directory under that home
WORKDIR $HOME/app
# 4. Copy code & deps spec
COPY . $HOME/app
COPY requirements.txt $HOME/app/requirements.txt
# 5. Install everything
RUN pip install --upgrade pip \
&& pip install -r requirements.txt \
&& pip install huggingface_hub
# 6. Download all Magic-PDF models AND emit your magic-pdf.json into $HOME
RUN wget -q https://raw.githubusercontent.com/Whth/Magic-PDF/master/scripts/download_models_hf.py -O download_models_hf.py \
&& python download_models_hf.py \
&& mv magic-pdf.json $HOME/ \
&& rm download_models_hf.py
# 7. Expose Gradio’s default port
EXPOSE 7860
# 8. Launch the app
CMD ["python", "app.py"]