feat(dwg): switch to ODA File Converter (libredwg too unstable)
ODA File Converter handles all DWG versions reliably. Uses xvfb for headless Qt operation in Docker. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+14
-29
@@ -1,42 +1,27 @@
|
||||
FROM ubuntu:24.04 AS builder
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
build-essential autoconf automake libtool pkg-config \
|
||||
wget ca-certificates && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Build libredwg from source (not available in apt repos)
|
||||
ARG LIBREDWG_VERSION=0.13.3
|
||||
RUN wget -q "https://github.com/LibreDWG/libredwg/releases/download/${LIBREDWG_VERSION}/libredwg-${LIBREDWG_VERSION}.tar.xz" && \
|
||||
tar xf "libredwg-${LIBREDWG_VERSION}.tar.xz" && \
|
||||
cd "libredwg-${LIBREDWG_VERSION}" && \
|
||||
./configure --prefix=/usr/local --disable-static --disable-docs && \
|
||||
make -j"$(nproc)" && \
|
||||
make install
|
||||
|
||||
# ---
|
||||
|
||||
FROM ubuntu:24.04
|
||||
|
||||
# Copy only the built binaries and libraries
|
||||
COPY --from=builder /usr/local/bin/dwg2dxf /usr/local/bin/
|
||||
COPY --from=builder /usr/local/lib/libredwg* /usr/local/lib/
|
||||
|
||||
RUN ldconfig && \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends python3 python3-pip && \
|
||||
# ODA File Converter needs Qt libs + virtual framebuffer for headless mode
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
python3 python3-pip wget ca-certificates \
|
||||
xvfb libxcb-xinerama0 libxcb-icccm4 libxcb-image0 \
|
||||
libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 \
|
||||
libxcb-shape0 libxcb-xkb1 libxkbcommon0 libxkbcommon-x11-0 \
|
||||
libglib2.0-0 libgl1 libfontconfig1 libfreetype6 && \
|
||||
pip3 install --no-cache-dir --break-system-packages flask && \
|
||||
apt-get purge -y python3-pip && \
|
||||
apt-get autoremove -y && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Download and install ODA File Converter
|
||||
RUN wget -q "https://download.opendesign.com/guestfiles/Demo/ODAFileConverter_QT6_lnxX64_8.3dll_25.12.deb" \
|
||||
-O /tmp/oda.deb && \
|
||||
dpkg -i /tmp/oda.deb || apt-get install -f -y && \
|
||||
rm /tmp/oda.deb
|
||||
|
||||
WORKDIR /app
|
||||
COPY app.py .
|
||||
|
||||
RUN useradd --system --no-create-home converter
|
||||
USER converter
|
||||
|
||||
EXPOSE 5001
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
|
||||
|
||||
Reference in New Issue
Block a user