marcosremar2 commited on
Commit
1b38816
·
1 Parent(s): 76f1a7c

Fix: Create output dir with correct permissions before COPY

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -4
Dockerfile CHANGED
@@ -54,6 +54,10 @@ RUN wget https://github.com/opendatalab/MinerU/raw/master/scripts/download_model
54
  wget https://github.com/opendatalab/MinerU/raw/master/magic-pdf.template.json -O $HOME/app/magic-pdf.json && \
55
  chown user:user $HOME/app/download_models.py $HOME/app/magic-pdf.json
56
 
 
 
 
 
57
  # Switch to user to run download script and copy app code
58
  USER user
59
 
@@ -64,10 +68,11 @@ RUN . /opt/mineru_venv/bin/activate && \
64
  sed -i 's|"device": "cpu"|"device": "cpu"|g' $HOME/magic-pdf.json
65
 
66
  # Copy the rest of the application code as the user
67
- COPY --chown=user . $HOME/app
 
68
 
69
- # Create output directories and set permissions (ensure this happens after WORKDIR and USER)
70
- # Already running as user, just need to create dirs
71
- RUN mkdir -p $HOME/app/output/images
72
 
73
  CMD ["/opt/mineru_venv/bin/uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
54
  wget https://github.com/opendatalab/MinerU/raw/master/magic-pdf.template.json -O $HOME/app/magic-pdf.json && \
55
  chown user:user $HOME/app/download_models.py $HOME/app/magic-pdf.json
56
 
57
+ # Create output directory and set ownership BEFORE switching user for COPY
58
+ RUN mkdir -p $HOME/app/output/images && \
59
+ chown -R user:user $HOME/app/output
60
+
61
  # Switch to user to run download script and copy app code
62
  USER user
63
 
 
68
  sed -i 's|"device": "cpu"|"device": "cpu"|g' $HOME/magic-pdf.json
69
 
70
  # Copy the rest of the application code as the user
71
+ # This will copy into the WORKDIR ($HOME/app)
72
+ COPY --chown=user . .
73
 
74
+ # Ensure the output dir still has correct permissions after final copy
75
+ # (This might be redundant but can help in some cases)
76
+ RUN chmod -R 755 $HOME/app/output
77
 
78
  CMD ["/opt/mineru_venv/bin/uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]