-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (29 loc) · 908 Bytes
/
Dockerfile
File metadata and controls
32 lines (29 loc) · 908 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
# Base
FROM node:22-slim AS base
WORKDIR /app
RUN --mount=type=cache,target=/root/.npm \
npm install -g bun@latest
# Dependencies
FROM base AS deps
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=bun.lockb,target=bun.lockb \
--mount=type=cache,target=/root/.bun/install/cache \
bun install --frozen-lockfile --production
# Build
FROM deps AS build
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=bun.lockb,target=bun.lockb \
--mount=type=cache,target=/root/.bun/install/cache \
bun install --frozen-lockfile
COPY . .
RUN bun run build
# Final
FROM gcr.io/distroless/nodejs22:nonroot AS final
WORKDIR /app
ENV NODE_ENV production
ENV HOST 0.0.0.0
ENV PORT 4321
EXPOSE ${PORT}
COPY --from=deps /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist
CMD ["/app/dist/server/entry.mjs"]