This commit is contained in:
Allan Carr
2025-07-13 00:17:08 -07:00
parent 231130267f
commit 7f782d5a64
19 changed files with 2564 additions and 1416 deletions

View File

@@ -3,40 +3,7 @@
FROM node:22-alpine AS builder
# Install build dependencies
RUN apk add --no-cache \
bash wget build-base autoconf automake cmake libtool pkgconf \
libjpeg-turbo-dev libpng-dev libwebp-dev tiff-dev libde265-dev \
ruby ruby-dev
# Replace source built libde265 and libheif with installed libraries in next release
# libheif-dev libde265-dev x265-dev
# Build libde265
WORKDIR /build/libde265
RUN wget https://github.com/strukturag/libde265/archive/v1.0.15.tar.gz \
&& tar -xvf v1.0.15.tar.gz \
&& cd libde265-1.0.15 \
&& cmake . \
&& make \
&& make install
# Build libheif
WORKDIR /build/libheif
RUN wget https://github.com/strukturag/libheif/archive/v1.19.7.tar.gz \
&& tar -xvf v1.19.7.tar.gz \
&& cd libheif-1.19.7 \
&& cmake --preset=release . \
&& make \
&& make install
# Build ImageMagick
WORKDIR /build/imagemagick
RUN wget https://download.imagemagick.org/archive/releases/ImageMagick-7.1.1-44.tar.xz \
&& tar -xvf ImageMagick-7.1.1-44.tar.xz \
&& cd ImageMagick-7.1.1-44 \
&& ./configure --with-heic=yes --with-webp=yes \
&& make \
&& make install
RUN apk add --no-cache bash wget
# Node.js application build stage
WORKDIR /usr/src/app
@@ -50,18 +17,12 @@ RUN npm run build
# Final stage
FROM node:22-alpine
# Enable community repository for additional packages
RUN echo "https://dl-cdn.alpinelinux.org/alpine/v$(grep -oE '[0-9]+\.[0-9]+' /etc/alpine-release)/community" >> /etc/apk/repositories
RUN apk update
# Install runtime dependencies only
RUN apk add --no-cache \
bash redis ghostscript graphicsmagick imagemagick \
libjpeg-turbo libpng libwebp tiff
# Copy built libraries from builder
COPY --from=builder /usr/local/lib/ /usr/local/lib/
COPY --from=builder /usr/local/bin/ /usr/local/bin/
COPY --from=builder /usr/local/include/ /usr/local/include/
# Update library cache
RUN ldconfig /usr/local/lib
RUN apk add --no-cache bash redis ghostscript graphicsmagick imagemagick libjpeg-turbo libpng libwebp tiff libheif libde265 x265 ffmpeg
RUN npm install -g pm2