-
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (39 loc) · 1.29 KB
/
Dockerfile
File metadata and controls
58 lines (39 loc) · 1.29 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
FROM node:25-alpine AS base
WORKDIR /app
ENV PNPM_HOME=/pnpm
ENV CI=1
# Use production in case any dependencies use it in any way
ENV NODE_ENV=production
# Enable node compile cache
ENV NODE_COMPILE_CACHE=/node-cc
RUN mkdir -p $NODE_COMPILE_CACHE
FROM base AS base_deps
ENV CI=1
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
RUN npm i -g npm@latest
RUN npm i -g --force corepack@latest
RUN corepack enable
RUN corepack prepare --activate
# Install dependencies
RUN --mount=type=cache,id=s/c47f3895-fff0-42c4-b1f7-cee7f61e6613-pnpm,target=/pnpm/store \
pnpm install --frozen-lockfile --ignore-scripts
FROM base_deps AS build
COPY tsconfig.json tsdown.config.ts ./
COPY src/ src/
RUN node --run build
FROM base_deps AS docs
COPY docs/openapi.yaml docs/openapi.yaml
RUN --mount=type=cache,id=s/c47f3895-fff0-42c4-b1f7-cee7f61e6613-pnpm,target=/pnpm/store \
node --run docs
FROM base
COPY src/ src/
COPY package.json pnpm-workspace.yaml ./
COPY ./src/ src/
COPY --from=build /app/dist dist/
COPY --from=docs /app/redoc-static.html .
# Run with...
# Source maps enabled, since it does not affect performance from what I found
ENV NODE_OPTIONS="--enable-source-maps"
# Warnings disabled, we know what we're doing and they're annoying
ENV NODE_NO_WARNINGS=1
CMD ["node", "--run", "start"]