2025-03-31 19:37:32 +00:00
|
|
|
FROM oven/bun:1.2.8-alpine AS base
|
2024-08-23 19:14:06 +02:00
|
|
|
LABEL org.opencontainers.image.source="https://github.com/C4illin/ConvertX"
|
2024-05-19 23:51:27 +02:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# install dependencies into temp directory
|
|
|
|
|
# this will cache them and speed up future builds
|
|
|
|
|
FROM base AS install
|
|
|
|
|
RUN mkdir -p /temp/dev
|
2025-02-01 21:09:12 +01:00
|
|
|
COPY package.json bun.lock /temp/dev/
|
2024-05-19 23:51:27 +02:00
|
|
|
RUN cd /temp/dev && bun install --frozen-lockfile
|
|
|
|
|
|
|
|
|
|
# install with --production (exclude devDependencies)
|
|
|
|
|
RUN mkdir -p /temp/prod
|
2025-02-01 21:09:12 +01:00
|
|
|
COPY package.json bun.lock /temp/prod/
|
2024-05-19 23:51:27 +02:00
|
|
|
RUN cd /temp/prod && bun install --frozen-lockfile --production
|
|
|
|
|
|
2024-08-23 19:14:06 +02:00
|
|
|
FROM base AS builder
|
|
|
|
|
RUN apk --no-cache add curl gcc
|
|
|
|
|
ENV PATH=/root/.cargo/bin:$PATH
|
|
|
|
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
|
|
|
RUN cargo install resvg
|
|
|
|
|
|
2025-03-08 01:08:00 +01:00
|
|
|
FROM base AS prerelease
|
2025-02-01 21:09:12 +01:00
|
|
|
WORKDIR /app
|
2024-09-09 17:38:03 +02:00
|
|
|
COPY --from=install /temp/dev/node_modules node_modules
|
|
|
|
|
COPY . .
|
2024-05-19 23:51:27 +02:00
|
|
|
|
2025-02-01 21:09:12 +01:00
|
|
|
# ENV NODE_ENV=production
|
2024-09-09 17:38:03 +02:00
|
|
|
RUN bun run build
|
2024-05-19 23:51:27 +02:00
|
|
|
|
|
|
|
|
# copy production dependencies and source code into final image
|
|
|
|
|
FROM base AS release
|
2024-05-29 11:59:52 +02:00
|
|
|
|
2025-02-18 21:24:54 +01:00
|
|
|
RUN apk --no-cache add qt6-qtbase-private-dev libheif-tools --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community/
|
|
|
|
|
|
2024-05-24 22:58:25 +02:00
|
|
|
# install additional dependencies
|
2024-06-20 20:23:34 +02:00
|
|
|
RUN apk --no-cache add \
|
2024-05-24 22:58:25 +02:00
|
|
|
pandoc \
|
2024-06-11 19:30:06 +02:00
|
|
|
texlive \
|
2024-06-27 23:26:46 +02:00
|
|
|
texlive-xetex \
|
2024-06-11 19:30:06 +02:00
|
|
|
texmf-dist-latexextra \
|
2024-05-24 22:58:25 +02:00
|
|
|
ffmpeg \
|
|
|
|
|
graphicsmagick \
|
2024-05-25 15:52:04 +02:00
|
|
|
ghostscript \
|
2024-06-11 19:30:06 +02:00
|
|
|
vips-tools \
|
2024-08-23 14:30:02 +02:00
|
|
|
vips-poppler \
|
|
|
|
|
vips-jxl \
|
2025-02-12 21:06:27 +01:00
|
|
|
vips-heif \
|
|
|
|
|
vips-magick \
|
2024-09-26 08:23:28 -04:00
|
|
|
libjxl-tools \
|
2024-11-16 11:34:47 +01:00
|
|
|
assimp \
|
2024-12-07 02:38:30 +01:00
|
|
|
inkscape \
|
2025-01-23 22:00:19 +01:00
|
|
|
poppler-utils \
|
|
|
|
|
gcompat \
|
2025-02-05 14:17:55 +01:00
|
|
|
libva-utils \
|
2025-02-18 21:24:54 +01:00
|
|
|
py3-numpy
|
2025-01-04 12:54:22 +01:00
|
|
|
|
2024-12-07 02:38:30 +01:00
|
|
|
RUN apk --no-cache add calibre --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/
|
2024-05-24 22:58:25 +02:00
|
|
|
|
2024-06-20 20:23:34 +02:00
|
|
|
# this might be needed for some latex use cases, will add it if needed.
|
|
|
|
|
# texmf-dist-fontsextra \
|
|
|
|
|
|
2024-05-19 23:51:27 +02:00
|
|
|
COPY --from=install /temp/prod/node_modules node_modules
|
2024-08-23 19:14:06 +02:00
|
|
|
COPY --from=builder /root/.cargo/bin/resvg /usr/local/bin/resvg
|
2024-10-18 19:32:42 +02:00
|
|
|
COPY --from=prerelease /app/public/generated.css /app/public/
|
2024-05-19 23:51:27 +02:00
|
|
|
COPY . .
|
|
|
|
|
|
|
|
|
|
EXPOSE 3000/tcp
|
2024-06-28 00:05:21 +02:00
|
|
|
ENV NODE_ENV=production
|
2024-05-19 23:51:27 +02:00
|
|
|
ENTRYPOINT [ "bun", "run", "./src/index.tsx" ]
|