From a23215a66e3e1d41bd7de074a7c9b2eb498b34e0 Mon Sep 17 00:00:00 2001 From: AI Assistant Date: Mon, 9 Mar 2026 10:58:34 +0200 Subject: [PATCH] fix(dwg): build libredwg from source (not in any apt repo) Multi-stage build: compile libredwg 0.13.3 in builder stage, copy only dwg2dxf binary + libs to final slim image. Co-Authored-By: Claude Opus 4.6 --- dwg2dxf-api/Dockerfile | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/dwg2dxf-api/Dockerfile b/dwg2dxf-api/Dockerfile index e2a2373..e697dd9 100644 --- a/dwg2dxf-api/Dockerfile +++ b/dwg2dxf-api/Dockerfile @@ -1,11 +1,31 @@ -FROM ubuntu:24.04 - -# Enable universe repo (libredwg-tools lives there) -RUN sed -i 's/Components: main/Components: main universe/' /etc/apt/sources.list.d/ubuntu.sources +FROM ubuntu:24.04 AS builder RUN apt-get update && \ apt-get install -y --no-install-recommends \ - python3 python3-pip libredwg-tools && \ + 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 && \ pip3 install --no-cache-dir --break-system-packages flask && \ apt-get purge -y python3-pip && \ apt-get autoremove -y && \