|
| 1 | +# syntax=docker/dockerfile:1.7 |
| 2 | + |
| 3 | +############################################################################### |
| 4 | +# 1. Build stage: Install daps and suse-xsl-stylesheets |
| 5 | +############################################################################### |
| 6 | +ARG OPENSUSE_VERSION=15.6 |
| 7 | +ARG URL=https://download.opensuse.org/repositories |
| 8 | + |
| 9 | +FROM opensuse/leap:${OPENSUSE_VERSION} AS build |
| 10 | + |
| 11 | +# Add the Documentation:Tools OBS repository and refresh |
| 12 | +RUN zypper ar -f ${URL}/Documentation:/Tools/'$releasever' Documentation_Tools ; \ |
| 13 | + zypper --gpg-auto-import-keys --non-interactive refresh |
| 14 | + |
| 15 | +# Now install all required packages (from default + custom repo) |
| 16 | +RUN zypper --non-interactive install --no-recommends \ |
| 17 | + curl ca-certificates sgml-skel gzip gpg2 \ |
| 18 | + google-noto-sans-jp-regular-fonts google-noto-sans-jp-bold-fonts \ |
| 19 | + google-noto-sans-sc-regular-fonts google-noto-sans-sc-bold-fonts \ |
| 20 | + google-noto-sans-kr-regular-fonts google-noto-sans-kr-bold-fonts \ |
| 21 | + google-noto-sans-tc-regular-fonts google-noto-sans-tc-bold-fonts \ |
| 22 | + arabic-amiri-fonts sil-charis-fonts gnu-free-fonts \ |
| 23 | + google-opensans-fonts dejavu-fonts google-poppins-fonts suse-fonts \ |
| 24 | + daps suse-xsl-stylesheets rsvg-convert geekodoc tar w3m jq openssh-clients && \ |
| 25 | + zypper clean --all |
| 26 | + |
| 27 | +# Remove unneeded files and packages to minimize image size |
| 28 | +RUN rm -rf \ |
| 29 | + /usr/bin/inkview \ |
| 30 | + /usr/share/icons \ |
| 31 | + /usr/share/man \ |
| 32 | + /usr/share/help \ |
| 33 | + /usr/share/locale \ |
| 34 | + /usr/share/doc \ |
| 35 | + /usr/share/libreoffice/help \ |
| 36 | + /usr/share/inkscape/tutorials \ |
| 37 | + /usr/share/inkscape/examples \ |
| 38 | + /usr/share/dia/help \ |
| 39 | + /usr/share/ghostscript/*/doc \ |
| 40 | + /usr/lib64/libreoffice/help \ |
| 41 | + /usr/lib64/libreoffice/program/wizards \ |
| 42 | + /usr/lib64/libreoffice/share/gallery \ |
| 43 | + /usr/lib64/libreoffice/share/template \ |
| 44 | + /usr/lib64/ruby/*/rdoc \ |
| 45 | + /usr/share/ghostscript/*/examples \ |
| 46 | + /usr/share/inkscape/icons \ |
| 47 | + /usr/share/kbd/keymaps/legacy \ |
| 48 | + /usr/share/xml/docbook/schema/xsd \ |
| 49 | + /usr/share/xml/docbook/stylesheet/nwalsh*/*/slides \ |
| 50 | + /var/log/* \ |
| 51 | + /usr/local/man \ |
| 52 | + /usr/lib64/libreoffice/share/config \ |
| 53 | + || true |
| 54 | + |
| 55 | +RUN rpm --erase --nodeps adwaita-icon-theme \ |
| 56 | + desktop-file-utils gtk2-tools gtk3-tools \ |
| 57 | + hicolor-icon-theme libreoffice-branding-openSUSE \ |
| 58 | + libreoffice-icon-themes || true |
| 59 | + |
| 60 | +############################################################################### |
| 61 | +# 2. Runtime stage: Minimal image with only daps and its dependencies |
| 62 | +############################################################################### |
| 63 | +FROM opensuse/leap:${OPENSUSE_VERSION} |
| 64 | + |
| 65 | +LABEL maintainer="Tom Schraitle" |
| 66 | +LABEL org.opencontainers.image.source="https://github.com/openSUSE/docbuild" |
| 67 | + |
| 68 | +# Copy daps and suse-xsl-stylesheets from build stage |
| 69 | +COPY --from=build /usr /usr |
| 70 | +COPY --from=build /etc /etc |
| 71 | + |
| 72 | +# Final cleanup to reduce image size |
| 73 | +RUN rm -rf /var/cache/zypp/* /var/log/* /tmp/* /usr/share/man /usr/share/doc /usr/share/locale |
| 74 | + |
| 75 | +# Set non-root user (optional, recommended for security) |
| 76 | +RUN useradd --create-home --shell /bin/bash dapsuser |
| 77 | +USER dapsuser |
| 78 | + |
| 79 | +RUN mkdir --parents ~/.config/daps && \ |
| 80 | + echo 'DOCBOOK5_RNG_URI="urn:x-suse:rng:v2:geekodoc-flat"' > ~/.config/daps/dapsrc |
| 81 | + |
| 82 | +WORKDIR /workspace |
| 83 | + |
| 84 | +ENV LANG=en_US.UTF-8 |
| 85 | +ENV LC_ALL=en_US.UTF-8 |
| 86 | +ENV TERM xterm-256color |
| 87 | + |
| 88 | +# ENTRYPOINT ["daps"] |
| 89 | +# CMD ["--help"] |
0 commit comments