We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 27c59ff commit 483c4fcCopy full SHA for 483c4fc
1 file changed
Dockerfile
@@ -1,17 +1,33 @@
1
-FROM oven/bun
+FROM oven/bun AS build
2
3
WORKDIR /app
4
5
-COPY package.json .
6
-COPY bun.lockb .
+# Cache packages installation
+COPY package.json package.json
7
+COPY bun.lock bun.lock
8
-RUN bun install --production
9
+RUN bun install
10
-COPY src src
11
-COPY tsconfig.json .
12
-# COPY public public
+COPY ./src ./src
13
14
-ENV NODE_ENV production
15
-CMD ["bun", "src/index.ts"]
+ENV NODE_ENV=production
+
+RUN bun build \
16
+ --compile \
17
+ --minify-whitespace \
18
+ --minify-syntax \
19
+ --target bun \
20
+ --outfile server \
21
+ ./src/index.ts
22
23
+FROM gcr.io/distroless/base
24
25
+WORKDIR /app
26
27
+COPY --from=build /app/server server
28
29
30
31
+CMD ["./server"]
32
33
EXPOSE 3500
0 commit comments