2023-08-02 01:56:10 +00:00
|
|
|
FROM node:18-bookworm@sha256:c85dc4392f44f5de1d0d72dd20a088a542734445f99bed7aa8ac895c706d370d as builder
|
2022-02-03 20:42:27 +00:00
|
|
|
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
2023-08-02 01:56:10 +00:00
|
|
|
COPY bin/install-ffmpeg.sh build-lock.json ./
|
|
|
|
RUN sed -i -e's/ main/ main contrib non-free non-free-firmware/g' /etc/apt/sources.list.d/debian.sources
|
|
|
|
RUN apt-get update && apt-get install -yqq build-essential ninja-build meson pkg-config jq \
|
|
|
|
libglib2.0-dev libexpat1-dev librsvg2-dev libexif-dev libwebp-dev liborc-0.4-dev libtiff5-dev \
|
|
|
|
libjpeg62-turbo-dev libgsf-1-dev libspng-dev libraw-dev libjxl-dev libheif-dev \
|
|
|
|
mesa-va-drivers libmimalloc2.0 $(if [ $(arch) = "x86_64" ]; then echo "intel-media-va-driver-non-free"; fi) \
|
|
|
|
&& ./install-ffmpeg.sh && apt-get autoremove && apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
# debian build for imagemagick has broken RAW support, so build manually
|
|
|
|
COPY bin/build-imagemagick.sh bin/build-libvips.sh ./
|
|
|
|
RUN ./build-imagemagick.sh
|
|
|
|
RUN ./build-libvips.sh
|
2022-11-10 01:53:21 +00:00
|
|
|
|
2022-02-07 21:06:30 +00:00
|
|
|
COPY package.json package-lock.json ./
|
2022-02-03 20:42:27 +00:00
|
|
|
|
2022-07-04 18:47:25 +00:00
|
|
|
RUN npm ci
|
2022-02-03 20:42:27 +00:00
|
|
|
|
|
|
|
COPY . .
|
|
|
|
|
2022-11-11 04:22:17 +00:00
|
|
|
FROM builder as prod
|
|
|
|
|
2022-06-07 13:08:22 +00:00
|
|
|
RUN npm run build
|
2023-02-03 03:28:34 +00:00
|
|
|
RUN npm prune --omit=dev --omit=optional
|
2022-11-11 04:22:17 +00:00
|
|
|
|
2023-08-02 01:56:10 +00:00
|
|
|
FROM node:18-bookworm-slim@sha256:a0cca98f2896135d4c0386922211c1f90f98f27a58b8f2c07850d0fbe1c2104e
|
2023-04-03 20:05:29 +00:00
|
|
|
|
|
|
|
ENV NODE_ENV=production
|
2022-08-21 04:19:02 +00:00
|
|
|
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
2023-08-02 01:56:10 +00:00
|
|
|
COPY bin/install-ffmpeg.sh build-lock.json ./
|
|
|
|
RUN sed -i -e's/ main/ main contrib non-free non-free-firmware/g' /etc/apt/sources.list.d/debian.sources
|
|
|
|
RUN apt-get update && apt-get install -yqq tini libheif1 libwebp7 libwebpdemux2 libwebpmux3 mesa-va-drivers \
|
|
|
|
libjpeg62-turbo libexpat1 librsvg2-2 libjxl0.7 libraw20 libtiff6 libspng0 libexif12 libgcc-s1 libglib2.0-0 \
|
|
|
|
libgsf-1-114 libopenjp2-7 liblcms2-2 liborc-0.4-0 libopenexr-3-1-30 liblqr-1-0 libltdl7 zlib1g \
|
|
|
|
mesa-va-drivers libmimalloc2.0 $(if [ $(arch) = "x86_64" ]; then echo "intel-media-va-driver-non-free"; fi) jq wget \
|
|
|
|
&& ./install-ffmpeg.sh && apt-get remove -yqq jq wget && apt-get autoremove -yqq && apt-get clean && rm -rf /var/lib/apt/lists/* \
|
|
|
|
&& rm install-ffmpeg.sh && rm build-lock.json
|
|
|
|
|
|
|
|
COPY --from=prod /usr/local/bin/magick /usr/local/bin/magick
|
|
|
|
COPY --from=prod /usr/local/include/ImageMagick-7 /usr/local/include/ImageMagick-7
|
|
|
|
|
|
|
|
COPY --from=prod /usr/local/bin/vips /usr/local/bin/vips
|
|
|
|
COPY --from=prod /usr/local/include/vips/ /usr/local/include/vips/
|
|
|
|
|
|
|
|
COPY --from=prod /usr/local/lib/ /usr/local/lib/
|
|
|
|
|
|
|
|
RUN ldconfig /usr/local/lib
|
2022-08-21 04:19:02 +00:00
|
|
|
|
2022-11-11 04:22:17 +00:00
|
|
|
COPY --from=prod /usr/src/app/node_modules ./node_modules
|
|
|
|
COPY --from=prod /usr/src/app/dist ./dist
|
|
|
|
COPY --from=prod /usr/src/app/bin ./bin
|
2022-08-21 04:19:02 +00:00
|
|
|
|
2022-11-10 01:53:21 +00:00
|
|
|
COPY LICENSE /licenses/LICENSE.txt
|
|
|
|
COPY LICENSE /LICENSE
|
|
|
|
COPY package.json package-lock.json ./
|
2023-06-08 15:01:07 +00:00
|
|
|
COPY start*.sh ./
|
2022-08-21 04:19:02 +00:00
|
|
|
|
2023-02-03 03:28:34 +00:00
|
|
|
RUN npm link && npm cache clean --force
|
2022-10-01 21:01:27 +00:00
|
|
|
VOLUME /usr/src/app/upload
|
|
|
|
|
2022-11-05 16:28:40 +00:00
|
|
|
EXPOSE 3001
|
2023-05-23 14:02:47 +00:00
|
|
|
|
2023-07-21 14:20:04 +00:00
|
|
|
ENTRYPOINT ["tini", "--", "/bin/sh"]
|