-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathDockerfile
55 lines (37 loc) · 1.22 KB
/
Dockerfile
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
FROM node:22-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 .npmrc package.json pnpm-lock.yaml ./
RUN corepack enable
RUN corepack prepare --activate
FROM base_deps as runtime_deps
# Install dependencies
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
pnpm install --frozen-lockfile --production
FROM base_deps AS docs
COPY docs/openapi.yaml docs/openapi.yaml
# Install dependencies
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
pnpm install --frozen-lockfile
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
pnpm run docs
FROM base
COPY .npmrc knexfile.js package.json pnpm-lock.yaml ./
COPY src/ src/
COPY migrations/ migrations/
COPY --from=runtime_deps /app/node_modules/ node_modules/
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"]