-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.server
More file actions
36 lines (28 loc) · 871 Bytes
/
Copy pathDockerfile.server
File metadata and controls
36 lines (28 loc) · 871 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
FROM oven/bun:1-debian as base
WORKDIR /app
# Module Stage (for caching)
FROM base AS modules
RUN apt-get update && apt-get install -y \
wget \
unzip
RUN mkdir -p /temp/dev
COPY package.json bun.lockb /temp/dev/
RUN mkdir -p /temp/prod
COPY package.json bun.lockb /temp/prod/
COPY scripts /temp/prod/scripts
RUN cd /temp/prod && bun run download
RUN cd /temp/dev && bun install --frozen-lockfile
# Build stage
FROM base AS builder
COPY --from=modules /temp/dev/node_modules node_modules
COPY . .
ENV NODE_ENV=production
RUN bun run server:build
# Release stage
FROM gcr.io/distroless/cc-debian12 as release
COPY --from=base /usr/local/bin/bun /usr/local/bin/bun
WORKDIR /app
COPY --from=modules /temp/prod/_bin _bin
COPY --from=builder /app/_build/frontend dist
COPY --from=builder /app/_build/backend .
ENTRYPOINT ["/usr/local/bin/bun", "run", "main.js"]