Files
ArchiTools/dwg2dxf-api/Dockerfile
T
AI Assistant a23215a66e 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>
2026-03-09 10:58:34 +02:00

46 lines
1.4 KiB
Docker

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 && \
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/*
WORKDIR /app
COPY app.py .
RUN useradd --system --no-create-home converter
USER converter
EXPOSE 5001
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:5001/health')" || exit 1
CMD ["python3", "app.py"]