Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 106 additions & 19 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,90 @@
FROM ghcr.io/linuxserver/baseimage-ubuntu:noble AS builder
FROM ghcr.io/linuxserver/baseimage-ubuntu:noble AS base

# ============================================================================
# Stage: plugin-base
# ============================================================================
FROM base AS plugin-base

ARG DEBIAN_FRONTEND="noninteractive"

# Install common build packages used by plugin builders
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
cmake \
extra-cmake-modules \
g++ \
gcc \
git \
make \
qt6-base-dev \
qt6-base-private-dev \
pkg-config && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# ============================================================================
# Stage: kimageformats-builder
# ============================================================================
FROM plugin-base AS kimageformats-builder

# Install additional dependencies for kimageformats
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libavif-dev \
libjxl-dev \
libarchive-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Build ECM 6.0.0 for KF6 (compatible with Qt 6.4)
RUN mkdir -p /tmp/ecm && \
git clone --depth 1 --branch v6.0.0 https://invent.kde.org/frameworks/extra-cmake-modules.git /tmp/ecm && \
mkdir -p /tmp/ecm/build && \
cd /tmp/ecm/build && \
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_TESTING=OFF && \
make -j$(nproc) && \
make install

# Build kimageformats 6.0.0 from KDE source (patched for Qt 6.4)
RUN mkdir -p /tmp/kimageformats && \
git clone --depth 1 --branch v6.0.0 https://invent.kde.org/frameworks/kimageformats.git /tmp/kimageformats && \
sed -i 's/6\.5\.0/6.4.0/g' /tmp/kimageformats/CMakeLists.txt && \
mkdir -p /tmp/kimageformats/build && \
cd /tmp/kimageformats/build && \
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_TESTING=OFF -DQT_MAJOR_VERSION=6 && \
make -j$(nproc) && \
make install DESTDIR=/output

# ============================================================================
# Stage: sevenzip-builder
# ============================================================================
FROM base AS sevenzip-builder

# get 7zip source
RUN apt-get update && \
apt-get install -y --no-install-recommends \
7zip \
build-essential \
make \
wget && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN cd /tmp && \
wget "https://github.com/YACReader/yacreader-7z-deps/blob/main/7z2301-src.7z?raw=true" -O 7z2301-src.7z && \
7z x 7z2301-src.7z -o/tmp/lib7zip

# install 7z.so with RAR support
RUN cd "/tmp/lib7zip/CPP/7zip/Bundles/Format7zF" && \
make -f makefile.gcc && \
mkdir -p /app/lib/7zip && \
cp ./_o/7z.so /app/lib/7zip

# ============================================================================
# Stage: yacreader-builder
# ============================================================================
FROM base AS yacreader-builder

# version, it can be a TAG or a branch
ARG YACR_VERSION="develop"
Expand Down Expand Up @@ -54,16 +140,17 @@ RUN \
zlib1g-dev && \
ldconfig


# clone YACReader repo
RUN git clone https://github.com/YACReader/yacreader.git /src/git && \
cd /src/git && \
git checkout $YACR_VERSION

# get 7zip source
RUN cd /src/git/compressed_archive && \
wget "https://github.com/YACReader/yacreader-7z-deps/blob/main/7z2301-src.7z?raw=true" -O /src/git/compressed_archive/7z2301-src.7z && \
7z x /src/git/compressed_archive/7z2301-src.7z -o/src/git/compressed_archive/lib7zip
# Copy pre-built 7z from sevenzip-builder stage
COPY --from=sevenzip-builder /tmp/lib7zip /src/git/compressed_archive/lib7zip
COPY --from=sevenzip-builder /app/lib/7zip /app/lib/7zip

# Copy kimageformats Qt6 plugins to builder
COPY --from=kimageformats-builder /output/usr/lib/x86_64-linux-gnu/qt6/plugins/imageformats/*.so /usr/lib/x86_64-linux-gnu/qt6/plugins/imageformats/

# build yacreaderlibraryserver
RUN cd /src/git/YACReaderLibraryServer && \
Expand All @@ -72,32 +159,32 @@ RUN cd /src/git/YACReaderLibraryServer && \
make && \
make install

# install 7z.so with RAR support
RUN echo "Building and installing 7z.so with RAR support..." && \
cd "/src/git/compressed_archive/lib7zip/CPP/7zip/Bundles/Format7zF" && \
make -f makefile.gcc && \
mkdir -p /app/lib/7zip && \
cp ./_o/7z.so /app/lib/7zip

# Stage 2: Runtime stage
FROM ghcr.io/linuxserver/baseimage-ubuntu:noble
# ============================================================================
# Stage: runtime
# ============================================================================
FROM base AS runtime

# env variables
ENV APPNAME="YACReaderLibraryServer"
ENV HOME="/config"
LABEL maintainer="luisangelsm"

# Copy the built application from the builder stage
COPY --from=builder /app /app
COPY --from=yacreader-builder /app /app

# Copy kimageformats Qt6 plugins to runtime
COPY --from=kimageformats-builder /output/usr/lib/x86_64-linux-gnu/qt6/plugins/imageformats/*.so /usr/lib/x86_64-linux-gnu/qt6/plugins/imageformats/

# runtime packages
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libqt6core5compat6 \
libpoppler-qt6-3t64 \
qt6-image-formats-plugins \
qt6-image-formats-plugins \
libqt6network6t64 \
libqt6sql6-sqlite && \
libqt6sql6-sqlite \
libavif16 \
libjxl0.7 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

Expand All @@ -106,7 +193,7 @@ ENV LC_ALL="en_US.UTF-8" \
PATH="/app/bin:${PATH}"

# copy files
COPY root.tar.gz /
COPY docker/root.tar.gz /
# Extract the contents of root.tar.gz into the / directory
RUN tar -xvpzf /root.tar.gz -C /

Expand Down