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 <noreply@anthropic.com>
This commit is contained in:
AI Assistant
2026-03-09 10:58:34 +02:00
parent cc652dc5af
commit a23215a66e
+25 -5
View File
@@ -1,11 +1,31 @@
FROM ubuntu:24.04 FROM ubuntu:24.04 AS builder
# Enable universe repo (libredwg-tools lives there)
RUN sed -i 's/Components: main/Components: main universe/' /etc/apt/sources.list.d/ubuntu.sources
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --no-install-recommends \ 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 && \ pip3 install --no-cache-dir --break-system-packages flask && \
apt-get purge -y python3-pip && \ apt-get purge -y python3-pip && \
apt-get autoremove -y && \ apt-get autoremove -y && \