linuxrun commited on
Commit
bab3986
·
verified ·
1 Parent(s): a6ece0d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +106 -103
Dockerfile CHANGED
@@ -1,104 +1,107 @@
1
- FROM debian:trixie-slim AS base
2
- LABEL org.opencontainers.image.source="https://github.com/C4illin/ConvertX"
3
- WORKDIR /app
4
-
5
- # install bun
6
- RUN apt-get update && apt-get install -y \
7
- curl \
8
- unzip \
9
- && rm -rf /var/lib/apt/lists/*
10
-
11
- # if architecture is arm64, use the arm64 version of bun
12
- RUN ARCH=$(uname -m) && \
13
- if [ "$ARCH" = "aarch64" ]; then \
14
- curl -fsSL -o bun-linux-aarch64.zip https://github.com/oven-sh/bun/releases/download/bun-v1.2.2/bun-linux-aarch64.zip; \
15
- else \
16
- 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; \
17
- fi
18
-
19
- RUN unzip -j bun-linux-*.zip -d /usr/local/bin && \
20
- rm bun-linux-*.zip && \
21
- chmod +x /usr/local/bin/bun
22
-
23
- # install dependencies into temp directory
24
- # this will cache them and speed up future builds
25
- FROM base AS install
26
- RUN mkdir -p /temp/dev
27
- COPY package.json bun.lock /temp/dev/
28
- RUN cd /temp/dev && bun install --frozen-lockfile
29
-
30
- # install with --production (exclude devDependencies)
31
- RUN mkdir -p /temp/prod
32
- COPY package.json bun.lock /temp/prod/
33
- RUN cd /temp/prod && bun install --frozen-lockfile --production
34
-
35
- FROM base AS prerelease
36
- WORKDIR /app
37
- COPY --from=install /temp/dev/node_modules node_modules
38
- COPY . .
39
-
40
- # ENV NODE_ENV=production
41
- RUN bun run build
42
-
43
- # copy production dependencies and source code into final image
44
- FROM base AS release
45
-
46
- # install additional dependencies
47
- RUN apt-get update && apt-get install -y \
48
- assimp-utils \
49
- calibre \
50
- dasel \
51
- dcraw \
52
- dvisvgm \
53
- ffmpeg \
54
- ghostscript \
55
- graphicsmagick \
56
- imagemagick-7.q16 \
57
- inkscape \
58
- latexmk \
59
- libheif-examples \
60
- libjxl-tools \
61
- libreoffice \
62
- libva2 \
63
- libvips-tools \
64
- libemail-outlook-message-perl \
65
- lmodern \
66
- mupdf-tools \
67
- pandoc \
68
- poppler-utils \
69
- potrace \
70
- python3-numpy \
71
- resvg \
72
- texlive \
73
- texlive-fonts-recommended \
74
- texlive-latex-extra \
75
- texlive-latex-recommended \
76
- texlive-xetex \
77
- --no-install-recommends \
78
- && rm -rf /var/lib/apt/lists/*
79
-
80
- # Install VTracer binary
81
- RUN ARCH=$(uname -m) && \
82
- if [ "$ARCH" = "aarch64" ]; then \
83
- VTRACER_ASSET="vtracer-aarch64-unknown-linux-musl.tar.gz"; \
84
- else \
85
- VTRACER_ASSET="vtracer-x86_64-unknown-linux-musl.tar.gz"; \
86
- fi && \
87
- curl -L -o /tmp/vtracer.tar.gz "https://github.com/visioncortex/vtracer/releases/download/0.6.4/${VTRACER_ASSET}" && \
88
- tar -xzf /tmp/vtracer.tar.gz -C /tmp/ && \
89
- mv /tmp/vtracer /usr/local/bin/vtracer && \
90
- chmod +x /usr/local/bin/vtracer && \
91
- rm /tmp/vtracer.tar.gz
92
-
93
- COPY --from=install /temp/prod/node_modules node_modules
94
- COPY --from=prerelease /app/public/ /app/public/
95
- COPY --from=prerelease /app/dist /app/dist
96
-
97
- # COPY . .
98
- RUN mkdir data
99
-
100
- EXPOSE 3000/tcp
101
- # used for calibre
102
- ENV QTWEBENGINE_CHROMIUM_FLAGS="--no-sandbox"
103
- ENV NODE_ENV=production
 
 
 
104
  ENTRYPOINT [ "bun", "run", "dist/src/index.js" ]
 
1
+ FROM debian:trixie-slim AS base
2
+ LABEL org.opencontainers.image.source="https://github.com/C4illin/ConvertX"
3
+ WORKDIR /app
4
+
5
+ # install bun
6
+ RUN apt-get update && apt-get install -y \
7
+ curl \
8
+ unzip \
9
+ && rm -rf /var/lib/apt/lists/*
10
+
11
+ # if architecture is arm64, use the arm64 version of bun
12
+ RUN ARCH=$(uname -m) && \
13
+ if [ "$ARCH" = "aarch64" ]; then \
14
+ curl -fsSL -o bun-linux-aarch64.zip https://github.com/oven-sh/bun/releases/download/bun-v1.2.2/bun-linux-aarch64.zip; \
15
+ else \
16
+ 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; \
17
+ fi
18
+
19
+ RUN unzip -j bun-linux-*.zip -d /usr/local/bin && \
20
+ rm bun-linux-*.zip && \
21
+ chmod +x /usr/local/bin/bun
22
+
23
+ # install dependencies into temp directory
24
+ # this will cache them and speed up future builds
25
+ FROM base AS install
26
+ RUN mkdir -p /temp/dev
27
+ COPY package.json bun.lock /temp/dev/
28
+ RUN cd /temp/dev && bun install --frozen-lockfile
29
+
30
+ # install with --production (exclude devDependencies)
31
+ RUN mkdir -p /temp/prod
32
+ COPY package.json bun.lock /temp/prod/
33
+ RUN cd /temp/prod && bun install --frozen-lockfile --production
34
+
35
+ FROM base AS prerelease
36
+ WORKDIR /app
37
+ COPY --from=install /temp/dev/node_modules node_modules
38
+ COPY . .
39
+
40
+ # ENV NODE_ENV=production
41
+ RUN bun run build
42
+
43
+ # copy production dependencies and source code into final image
44
+ FROM base AS release
45
+
46
+ # install additional dependencies
47
+ RUN apt-get update && apt-get install -y \
48
+ assimp-utils \
49
+ calibre \
50
+ dasel \
51
+ dcraw \
52
+ dvisvgm \
53
+ ffmpeg \
54
+ ghostscript \
55
+ graphicsmagick \
56
+ imagemagick-7.q16 \
57
+ inkscape \
58
+ latexmk \
59
+ libheif-examples \
60
+ libjxl-tools \
61
+ libreoffice \
62
+ libva2 \
63
+ libvips-tools \
64
+ libemail-outlook-message-perl \
65
+ lmodern \
66
+ mupdf-tools \
67
+ pandoc \
68
+ poppler-utils \
69
+ potrace \
70
+ python3-numpy \
71
+ resvg \
72
+ texlive \
73
+ texlive-fonts-recommended \
74
+ texlive-latex-extra \
75
+ texlive-latex-recommended \
76
+ texlive-xetex \
77
+ --no-install-recommends \
78
+ && rm -rf /var/lib/apt/lists/*
79
+
80
+ # Install VTracer binary
81
+ RUN ARCH=$(uname -m) && \
82
+ if [ "$ARCH" = "aarch64" ]; then \
83
+ VTRACER_ASSET="vtracer-aarch64-unknown-linux-musl.tar.gz"; \
84
+ else \
85
+ VTRACER_ASSET="vtracer-x86_64-unknown-linux-musl.tar.gz"; \
86
+ fi && \
87
+ curl -L -o /tmp/vtracer.tar.gz "https://github.com/visioncortex/vtracer/releases/download/0.6.4/${VTRACER_ASSET}" && \
88
+ tar -xzf /tmp/vtracer.tar.gz -C /tmp/ && \
89
+ mv /tmp/vtracer /usr/local/bin/vtracer && \
90
+ chmod +x /usr/local/bin/vtracer && \
91
+ rm /tmp/vtracer.tar.gz
92
+
93
+ COPY --from=install /temp/prod/node_modules node_modules
94
+ COPY --from=prerelease /app/public/ /app/public/
95
+ COPY --from=prerelease /app/dist /app/dist
96
+
97
+ # COPY . .
98
+ RUN mkdir data
99
+ RUN chmod 777 /app/data
100
+ RUN touch /app/data/mydb.sqlite
101
+ RUN chmod 666 /app/data/mydb.sqlite
102
+
103
+ EXPOSE 3000/tcp
104
+ # used for calibre
105
+ ENV QTWEBENGINE_CHROMIUM_FLAGS="--no-sandbox"
106
+ ENV NODE_ENV=production
107
  ENTRYPOINT [ "bun", "run", "dist/src/index.js" ]