marcosremar2 commited on
Commit
8ed061f
·
1 Parent(s): e432715

Fix: Copy final magic-pdf.json to /root

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -0
Dockerfile CHANGED
@@ -64,11 +64,20 @@ RUN mkdir -p $HOME/app/output/images && \
64
  USER user
65
 
66
  # Run model download script and configure magic-pdf for CUDA
 
67
  RUN . /opt/mineru_venv/bin/activate && \
68
  python3 $HOME/app/download_models.py && \
69
  cp $HOME/app/magic-pdf.json $HOME/magic-pdf.json && \
70
  sed -i 's|"device": "cpu"|"device": "cuda"|g' $HOME/magic-pdf.json
71
 
 
 
 
 
 
 
 
 
72
  # Copy the rest of the application code as the user
73
  COPY --chown=user . .
74
 
 
64
  USER user
65
 
66
  # Run model download script and configure magic-pdf for CUDA
67
+ # This should update $HOME/magic-pdf.json with correct cache paths
68
  RUN . /opt/mineru_venv/bin/activate && \
69
  python3 $HOME/app/download_models.py && \
70
  cp $HOME/app/magic-pdf.json $HOME/magic-pdf.json && \
71
  sed -i 's|"device": "cpu"|"device": "cuda"|g' $HOME/magic-pdf.json
72
 
73
+ # Switch back to root temporarily to copy the final config to /root
74
+ USER root
75
+ RUN cp $HOME/magic-pdf.json /root/magic-pdf.json && \
76
+ chown root:root /root/magic-pdf.json
77
+
78
+ # Switch back to the non-root user for running the app and copying files
79
+ USER user
80
+
81
  # Copy the rest of the application code as the user
82
  COPY --chown=user . .
83