Skip to content

Commit

Permalink
docker logic to avoid rebuilding large image every time for easy dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Frooodle committed Apr 15, 2023
1 parent 03febd9 commit 0a7517e
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 43 deletions.
44 changes: 1 addition & 43 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,47 +1,5 @@
# Build jbig2enc in a separate stage
FROM debian:bullseye-slim as jbig2enc_builder

RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
automake \
autoconf \
libtool \
libleptonica-dev \
pkg-config \
ca-certificates \
zlib1g-dev \
make \
g++

RUN git clone https://github.com/agl/jbig2enc && \
cd jbig2enc && \
./autogen.sh && \
./configure && \
make && \
make install

# Main stage
FROM openjdk:17-jdk-slim

# Install necessary dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libreoffice-core \
libreoffice-common \
libreoffice-writer \
libreoffice-calc \
libreoffice-impress \
python3-uno \
python3-pip \
unoconv \
pngquant \
unpaper \
ocrmypdf && \
pip install --user --upgrade ocrmypdf

# Copy the jbig2enc binary from the builder stage
COPY --from=jbig2enc_builder /usr/local/bin/jbig2 /usr/local/bin/jbig2
FROM frooodle/stirling-pdf-base:latest

# Copy the application JAR file
COPY build/libs/*.jar app.jar
Expand Down
44 changes: 44 additions & 0 deletions DockerfileBase
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Build jbig2enc in a separate stage
FROM debian:bullseye-slim as jbig2enc_builder

RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
automake \
autoconf \
libtool \
libleptonica-dev \
pkg-config \
ca-certificates \
zlib1g-dev \
make \
g++

RUN git clone https://github.com/agl/jbig2enc && \
cd jbig2enc && \
./autogen.sh && \
./configure && \
make && \
make install

# Main stage
FROM openjdk:17-jdk-slim

# Install necessary dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libreoffice-core \
libreoffice-common \
libreoffice-writer \
libreoffice-calc \
libreoffice-impress \
python3-uno \
python3-pip \
unoconv \
pngquant \
unpaper \
ocrmypdf && \
pip install --user --upgrade ocrmypdf

# Copy the jbig2enc binary from the builder stage
COPY --from=jbig2enc_builder /usr/local/bin/jbig2 /usr/local/bin/jbig2

0 comments on commit 0a7517e

Please sign in to comment.