forked from henrygd/ncaa-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
37 lines (26 loc) · 879 Bytes
/
dockerfile
File metadata and controls
37 lines (26 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# -------------------- BUILD STAGE --------------------
FROM oven/bun:slim AS builder
WORKDIR /app
ENV NODE_ENV=production
# copy only the files needed for install
COPY package.json bun.lockb tsconfig.json ./
# install dependencies (skip frozen lockfile issues)
RUN rm -f bun.lockb && bun install --production --no-cache
# copy source after install for better cache usage
COPY src ./src
# build your app to a single binary
RUN bun build \
--compile \
--minify-whitespace \
--minify-syntax \
--target bun \
--outfile server \
./src/index.ts
# -------------------- RUNTIME STAGE --------------------
FROM gcr.io/distroless/base:nonroot
WORKDIR /
# copy built binary from builder stage
COPY --from=builder /app/server .
# expose port and define startup command
EXPOSE 3000
CMD ["./server"]