-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (27 loc) · 852 Bytes
/
Copy pathDockerfile
File metadata and controls
36 lines (27 loc) · 852 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
# syntax=docker/dockerfile:1
# Base stage with common workdir
FROM docker.io/oven/bun:1 AS base
WORKDIR /usr/src/app
# Dependencies installation with cache mount
FROM base AS deps
COPY package.json bun.lock ./
RUN --mount=type=cache,target=/root/.bun/install/cache \
bun install --frozen-lockfile
# Build stage
FROM base AS build
COPY --from=deps /usr/src/app/node_modules ./node_modules
COPY . .
ENV NODE_ENV=production
RUN bun run build
# Production release
FROM docker.io/node:22-alpine AS release
WORKDIR /usr/src/app
COPY --from=build /usr/src/app/.output ./
ENV NODE_ENV=production \
HOST=0.0.0.0 \
PORT=3000
USER node
EXPOSE 3000
HEALTHCHECK --interval=10s --timeout=3s --start-period=10s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:3000/api/health || exit 1
CMD ["node", "server/index.mjs"]