Threscomma commited on
Commit
d8b1c62
·
verified ·
1 Parent(s): 7c1cd5e

Update .dockerfile

Browse files
Files changed (1) hide show
  1. .dockerfile +14 -7
.dockerfile CHANGED
@@ -1,22 +1,29 @@
1
- # Base image with Python 3.10
 
 
 
2
  FROM python:3.10-slim
3
 
4
- # Install LibreOffice and dependencies (FORCE install)
 
 
 
 
 
5
  RUN apt-get update && \
6
  apt-get install -y --no-install-recommends \
7
- libreoffice \
8
  poppler-utils \
9
- libgl1 \ # Required for some PDF rendering
10
  && apt-get clean \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- # Verify LibreOffice exists
14
- RUN which libreoffice || echo "LibreOffice not found lho!"
15
 
16
  WORKDIR /app
17
  COPY . .
18
 
19
- # Install Python packages
20
  RUN pip install --no-cache-dir -r requirements.txt
21
 
22
  CMD ["python", "app.py"]
 
1
+ # Start from an image with LibreOffice preinstalled
2
+ FROM jacobalberty/libreoffice:latest as libreoffice
3
+
4
+ # Final stage
5
  FROM python:3.10-slim
6
 
7
+ # Copy LibreOffice from the prebuilt image
8
+ COPY --from=libreoffice /usr/lib/libreoffice /usr/lib/libreoffice
9
+ COPY --from=libreoffice /usr/bin/libreoffice /usr/bin/libreoffice
10
+ COPY --from=libreoffice /usr/share/libreoffice /usr/share/libreoffice
11
+
12
+ # Install remaining dependencies
13
  RUN apt-get update && \
14
  apt-get install -y --no-install-recommends \
 
15
  poppler-utils \
16
+ libgl1 \
17
  && apt-get clean \
18
  && rm -rf /var/lib/apt/lists/*
19
 
20
+ # Verify install
21
+ RUN libreoffice --version || echo "LibreOffice verification failed"
22
 
23
  WORKDIR /app
24
  COPY . .
25
 
26
+ # Install Python deps
27
  RUN pip install --no-cache-dir -r requirements.txt
28
 
29
  CMD ["python", "app.py"]