Files
ConvertX/Dockerfile
T

81 lines
2.1 KiB
Docker
Raw Normal View History

2025-05-22 12:28:03 +02:00
FROM debian:trixie-slim 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
2025-05-22 12:28:03 +02:00
# install bun
RUN apt-get update && apt-get install -y \
curl \
unzip \
&& rm -rf /var/lib/apt/lists/*
2025-06-04 10:26:28 +02:00
# if architecture is arm64, use the arm64 version of bun
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "aarch64" ]; then \
curl -fsSL -o bun-linux-aarch64.zip https://github.com/oven-sh/bun/releases/download/bun-v1.2.2/bun-linux-aarch64.zip; \
else \
curl -fsSL -o bun-linux-x64-baseline.zip https://github.com/oven-sh/bun/releases/download/bun-v1.2.2/bun-linux-x64-baseline.zip; \
fi
RUN unzip -j bun-linux-*.zip -d /usr/local/bin && \
rm bun-linux-*.zip && \
chmod +x /usr/local/bin/bun
2025-05-22 12:28:03 +02:00
2024-05-19 23:51:27 +02:00
# 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
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
2024-05-24 22:58:25 +02:00
# install additional dependencies
2025-05-22 12:28:03 +02:00
RUN apt-get update && apt-get install -y \
assimp-utils \
calibre \
dcraw \
2025-06-03 17:58:43 +02:00
dvisvgm \
2024-05-24 22:58:25 +02:00
ffmpeg \
2024-05-25 15:52:04 +02:00
ghostscript \
2025-05-22 12:28:03 +02:00
graphicsmagick \
2025-06-03 17:58:43 +02:00
imagemagick-7.q16 \
2024-12-07 02:38:30 +01:00
inkscape \
2025-05-22 12:28:03 +02:00
libheif-examples \
libjxl-tools \
libva2 \
libvips-tools \
2025-06-03 17:58:43 +02:00
mupdf-tools \
2025-05-22 12:28:03 +02:00
pandoc \
2025-01-23 22:00:19 +01:00
poppler-utils \
2025-05-22 12:28:03 +02:00
potrace \
python3-numpy \
resvg \
texlive \
texlive-latex-extra \
texlive-xetex \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
2024-06-20 20:23:34 +02:00
2024-05-19 23:51:27 +02:00
COPY --from=install /temp/prod/node_modules node_modules
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
2025-06-08 21:29:58 +02:00
# used for calibre
ENV QTWEBENGINE_CHROMIUM_FLAGS="--no-sandbox"
ENV NODE_ENV=production
2024-05-19 23:51:27 +02:00
ENTRYPOINT [ "bun", "run", "./src/index.tsx" ]