Spaces:
Build error
Build error
Update .dockerfile
Browse files- .dockerfile +14 -7
.dockerfile
CHANGED
|
@@ -1,22 +1,29 @@
|
|
| 1 |
-
#
|
|
|
|
|
|
|
|
|
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
RUN apt-get update && \
|
| 6 |
apt-get install -y --no-install-recommends \
|
| 7 |
-
libreoffice \
|
| 8 |
poppler-utils \
|
| 9 |
-
libgl1 \
|
| 10 |
&& apt-get clean \
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
-
# Verify
|
| 14 |
-
RUN
|
| 15 |
|
| 16 |
WORKDIR /app
|
| 17 |
COPY . .
|
| 18 |
|
| 19 |
-
# Install Python
|
| 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"]
|