Dockerfile 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. FROM oven/bun:1.2.2-alpine AS base
  2. LABEL org.opencontainers.image.source="https://github.com/C4illin/ConvertX"
  3. WORKDIR /app
  4. # install dependencies into temp directory
  5. # this will cache them and speed up future builds
  6. FROM base AS install
  7. RUN mkdir -p /temp/dev
  8. COPY package.json bun.lock /temp/dev/
  9. RUN cd /temp/dev && bun install --frozen-lockfile
  10. # install with --production (exclude devDependencies)
  11. RUN mkdir -p /temp/prod
  12. COPY package.json bun.lock /temp/prod/
  13. RUN cd /temp/prod && bun install --frozen-lockfile --production
  14. FROM base AS resvg
  15. RUN apk --no-cache add curl gcc
  16. ENV PATH=/root/.cargo/bin:$PATH
  17. RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
  18. RUN cargo install resvg
  19. FROM base AS dcraw
  20. # build dcraw
  21. RUN apk --no-cache add build-base wget tar jasper-dev jpeg-dev lcms2-dev libc6-compat gettext libintl gettext-dev gettext-libs gettext-lang gettext-static intltool linux-tools-dev
  22. RUN mkdir -p /temp
  23. WORKDIR /temp
  24. RUN wget https://www.dechifro.org/dcraw/archive/dcraw-9.28.0.tar.gz ; \
  25. tar -xzvf dcraw-*.tar.gz ; cd dcraw ; chmod 755 install ; ./install ;
  26. # copy node_modules from temp directory
  27. # then copy all (non-ignored) project files into the image
  28. # will switch to alpine again when it works
  29. FROM oven/bun:1.2.2-slim AS prerelease
  30. WORKDIR /app
  31. COPY --from=install /temp/dev/node_modules node_modules
  32. COPY . .
  33. # ENV NODE_ENV=production
  34. RUN bun run build
  35. # copy production dependencies and source code into final image
  36. FROM base AS release
  37. LABEL maintainer="Emrik Östling (C4illin)"
  38. LABEL description="ConvertX: self-hosted online file converter supporting 700+ file formats."
  39. LABEL repo="https://github.com/C4illin/ConvertX"
  40. RUN apk --no-cache add qt6-qtbase-private-dev libheif-tools --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community/
  41. # install additional dependencies
  42. RUN apk --no-cache add \
  43. pandoc \
  44. texlive \
  45. texlive-xetex \
  46. texmf-dist-latexextra \
  47. ffmpeg \
  48. graphicsmagick \
  49. ghostscript \
  50. vips-tools \
  51. vips-poppler \
  52. vips-jxl \
  53. vips-heif \
  54. vips-magick \
  55. libjxl-tools \
  56. assimp \
  57. inkscape \
  58. poppler-utils \
  59. gcompat \
  60. libva-utils \
  61. py3-numpy
  62. RUN apk --no-cache add calibre --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/
  63. # this might be needed for some latex use cases, will add it if needed.
  64. # texmf-dist-fontsextra \
  65. COPY --from=install /temp/prod/node_modules node_modules
  66. COPY --from=resvg /root/.cargo/bin/resvg /usr/local/bin/resvg
  67. COPY --from=dcraw /usr/local/bin/dcraw /usr/local/bin/dcraw
  68. COPY --from=prerelease /app/public/generated.css /app/public/
  69. # COPY --from=prerelease /app/src/index.tsx /app/src/
  70. # COPY --from=prerelease /app/package.json .
  71. COPY . .
  72. EXPOSE 3000/tcp
  73. ENV NODE_ENV=production
  74. ENTRYPOINT [ "bun", "run", "./src/index.tsx" ]