Files
ConvertX/Dockerfile
T

67 lines
1.9 KiB
Docker
Raw Normal View History

FROM oven/bun:1.1.34-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
COPY package.json bun.lockb /temp/dev/
RUN cd /temp/dev && bun install --frozen-lockfile
# install with --production (exclude devDependencies)
RUN mkdir -p /temp/prod
COPY package.json bun.lockb /temp/prod/
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
2024-05-19 23:51:27 +02:00
# copy node_modules from temp directory
# then copy all (non-ignored) project files into the image
2024-09-09 17:38:03 +02:00
FROM base AS prerelease
COPY --from=install /temp/dev/node_modules node_modules
COPY . .
2024-05-19 23:51:27 +02:00
2024-05-21 15:34:38 +02:00
# # [optional] tests & build
2024-09-09 17:38:03 +02:00
ENV NODE_ENV=production
2024-05-19 23:51:27 +02:00
# RUN bun test
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
LABEL maintainer="Emrik Östling (C4illin)"
LABEL description="ConvertX: self-hosted online file converter supporting 700+ file formats."
LABEL repo="https://github.com/C4illin/ConvertX"
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 \
libjxl-tools \
assimp
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-21 15:34:38 +02:00
# COPY --from=prerelease /app/src/index.tsx /app/src/
# COPY --from=prerelease /app/package.json .
2024-05-19 23:51:27 +02:00
COPY . .
EXPOSE 3000/tcp
ENV NODE_ENV=production
2024-05-19 23:51:27 +02:00
ENTRYPOINT [ "bun", "run", "./src/index.tsx" ]