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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM debian:trixie-slim AS base
|
| 2 |
+
|
| 3 |
+
LABEL org.opencontainers.image.source="https://github.com/C4illin/ConvertX"
|
| 4 |
+
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
# install bun
|
| 10 |
+
|
| 11 |
+
RUN apt-get update && apt-get install -y \
|
| 12 |
+
|
| 13 |
+
curl \
|
| 14 |
+
|
| 15 |
+
unzip \
|
| 16 |
+
|
| 17 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
# if architecture is arm64, use the arm64 version of bun
|
| 22 |
+
|
| 23 |
+
RUN ARCH=$(uname -m) && \
|
| 24 |
+
|
| 25 |
+
if [ "$ARCH" = "aarch64" ]; then \
|
| 26 |
+
|
| 27 |
+
curl -fsSL -o bun-linux-aarch64.zip https://github.com/oven-sh/bun/releases/download/bun-v1.2.2/bun-linux-aarch64.zip; \
|
| 28 |
+
|
| 29 |
+
else \
|
| 30 |
+
|
| 31 |
+
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; \
|
| 32 |
+
|
| 33 |
+
fi
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
RUN unzip -j bun-linux-*.zip -d /usr/local/bin && \
|
| 38 |
+
|
| 39 |
+
rm bun-linux-*.zip && \
|
| 40 |
+
|
| 41 |
+
chmod +x /usr/local/bin/bun
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
# install dependencies into temp directory
|
| 46 |
+
|
| 47 |
+
# this will cache them and speed up future builds
|
| 48 |
+
|
| 49 |
+
FROM base AS install
|
| 50 |
+
|
| 51 |
+
RUN mkdir -p /temp/dev
|
| 52 |
+
|
| 53 |
+
COPY package.json bun.lock /temp/dev/
|
| 54 |
+
|
| 55 |
+
RUN cd /temp/dev && bun install --frozen-lockfile
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
# install with --production (exclude devDependencies)
|
| 60 |
+
|
| 61 |
+
RUN mkdir -p /temp/prod
|
| 62 |
+
|
| 63 |
+
COPY package.json bun.lock /temp/prod/
|
| 64 |
+
|
| 65 |
+
RUN cd /temp/prod && bun install --frozen-lockfile --production
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
FROM base AS prerelease
|
| 70 |
+
|
| 71 |
+
WORKDIR /app
|
| 72 |
+
|
| 73 |
+
COPY --from=install /temp/dev/node_modules node_modules
|
| 74 |
+
|
| 75 |
+
COPY . .
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
# ENV NODE_ENV=production
|
| 80 |
+
|
| 81 |
+
RUN bun run build
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
# copy production dependencies and source code into final image
|
| 86 |
+
|
| 87 |
+
FROM base AS release
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
# install additional dependencies
|
| 92 |
+
|
| 93 |
+
RUN apt-get update && apt-get install -y \
|
| 94 |
+
|
| 95 |
+
assimp-utils \
|
| 96 |
+
|
| 97 |
+
calibre \
|
| 98 |
+
|
| 99 |
+
dasel \
|
| 100 |
+
|
| 101 |
+
dcraw \
|
| 102 |
+
|
| 103 |
+
dvisvgm \
|
| 104 |
+
|
| 105 |
+
ffmpeg \
|
| 106 |
+
|
| 107 |
+
ghostscript \
|
| 108 |
+
|
| 109 |
+
graphicsmagick \
|
| 110 |
+
|
| 111 |
+
imagemagick-7.q16 \
|
| 112 |
+
|
| 113 |
+
inkscape \
|
| 114 |
+
|
| 115 |
+
latexmk \
|
| 116 |
+
|
| 117 |
+
libheif-examples \
|
| 118 |
+
|
| 119 |
+
libjxl-tools \
|
| 120 |
+
|
| 121 |
+
libreoffice \
|
| 122 |
+
|
| 123 |
+
libva2 \
|
| 124 |
+
|
| 125 |
+
libvips-tools \
|
| 126 |
+
|
| 127 |
+
libemail-outlook-message-perl \
|
| 128 |
+
|
| 129 |
+
lmodern \
|
| 130 |
+
|
| 131 |
+
mupdf-tools \
|
| 132 |
+
|
| 133 |
+
pandoc \
|
| 134 |
+
|
| 135 |
+
poppler-utils \
|
| 136 |
+
|
| 137 |
+
potrace \
|
| 138 |
+
|
| 139 |
+
python3-numpy \
|
| 140 |
+
|
| 141 |
+
resvg \
|
| 142 |
+
|
| 143 |
+
texlive \
|
| 144 |
+
|
| 145 |
+
texlive-fonts-recommended \
|
| 146 |
+
|
| 147 |
+
texlive-latex-extra \
|
| 148 |
+
|
| 149 |
+
texlive-latex-recommended \
|
| 150 |
+
|
| 151 |
+
texlive-xetex \
|
| 152 |
+
|
| 153 |
+
--no-install-recommends \
|
| 154 |
+
|
| 155 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
# Install VTracer binary
|
| 160 |
+
|
| 161 |
+
RUN ARCH=$(uname -m) && \
|
| 162 |
+
|
| 163 |
+
if [ "$ARCH" = "aarch64" ]; then \
|
| 164 |
+
|
| 165 |
+
VTRACER_ASSET="vtracer-aarch64-unknown-linux-musl.tar.gz"; \
|
| 166 |
+
|
| 167 |
+
else \
|
| 168 |
+
|
| 169 |
+
VTRACER_ASSET="vtracer-x86_64-unknown-linux-musl.tar.gz"; \
|
| 170 |
+
|
| 171 |
+
fi && \
|
| 172 |
+
|
| 173 |
+
curl -L -o /tmp/vtracer.tar.gz "https://github.com/visioncortex/vtracer/releases/download/0.6.4/${VTRACER_ASSET}" && \
|
| 174 |
+
|
| 175 |
+
tar -xzf /tmp/vtracer.tar.gz -C /tmp/ && \
|
| 176 |
+
|
| 177 |
+
mv /tmp/vtracer /usr/local/bin/vtracer && \
|
| 178 |
+
|
| 179 |
+
chmod +x /usr/local/bin/vtracer && \
|
| 180 |
+
|
| 181 |
+
rm /tmp/vtracer.tar.gz
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
COPY --from=install /temp/prod/node_modules node_modules
|
| 186 |
+
|
| 187 |
+
COPY --from=prerelease /app/public/ /app/public/
|
| 188 |
+
|
| 189 |
+
COPY --from=prerelease /app/dist /app/dist
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
# COPY . .
|
| 194 |
+
|
| 195 |
+
RUN mkdir data
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
EXPOSE 3000/tcp
|
| 200 |
+
|
| 201 |
+
# used for calibre
|
| 202 |
+
|
| 203 |
+
ENV QTWEBENGINE_CHROMIUM_FLAGS="--no-sandbox"
|
| 204 |
+
|
| 205 |
+
ENV NODE_ENV=production
|
| 206 |
+
|
| 207 |
+
ENTRYPOINT [ "bun", "run", "dist/src/index.js" ]
|