Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (54 loc) · 3.13 KB
/
Copy pathDockerfile
File metadata and controls
65 lines (54 loc) · 3.13 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
59
60
61
62
63
64
65
FROM node:24-bookworm-slim@sha256:ba849c60be29959425b8734d57b8b4b7d56f98edd9504c9af091d5281095a71e AS build
WORKDIR /app
COPY package.json package-lock.json ./
COPY apps ./apps
COPY packages ./packages
RUN npm ci
COPY tsconfig.json tsconfig.build.json ./
COPY scripts ./scripts
COPY LICENSE ./LICENSE
RUN npm run check:boundaries && npm run build
FROM node:24-bookworm-slim@sha256:ba849c60be29959425b8734d57b8b4b7d56f98edd9504c9af091d5281095a71e AS production-dependencies
WORKDIR /app
COPY deploy/runtime/package.json deploy/runtime/package-lock.json ./
RUN npm ci --omit=dev
FROM node:24-bookworm-slim@sha256:ba849c60be29959425b8734d57b8b4b7d56f98edd9504c9af091d5281095a71e AS runtime-files
ENV NODE_ENV=production
WORKDIR /app
COPY --from=production-dependencies --chown=node:node /app/package.json /app/package-lock.json ./
COPY --from=production-dependencies --chown=node:node /app/node_modules ./node_modules
COPY --from=build --chown=node:node /app/dist ./dist
COPY --from=build --chown=node:node /app/LICENSE ./LICENSE
COPY --chown=node:node third-party-notices ./third-party-notices
FROM runtime-files AS runtime-user
USER node
FROM runtime-user AS gateway
EXPOSE 8787
HEALTHCHECK --interval=15s --timeout=3s --start-period=10s --retries=3 \
CMD ["node", "-e", "const h=require('node:http');const q=h.get({host:'127.0.0.1',port:process.env.GATEWAY_PORT||8787,path:'/health/live',headers:{host:process.env.CONTROL_HOST||'control.'+(process.env.CONTENT_DOMAIN||'localhost')}},r=>process.exit(r.statusCode===200?0:1));q.on('error',()=>process.exit(1));q.setTimeout(2500,()=>q.destroy())"]
CMD ["node", "dist/apps/gateway/src/main.js"]
FROM runtime-user AS admin-cli
ENTRYPOINT ["node", "dist/apps/admin-cli/src/main.js"]
FROM runtime-user AS client
ENTRYPOINT ["node", "dist/apps/client/src/main.js"]
FROM runtime-user AS canary-check
COPY --from=build --chown=node:node /app/scripts/verify-public-path.mjs ./scripts/verify-public-path.mjs
COPY --from=build --chown=node:node /app/scripts/canary-policy.mjs ./scripts/canary-policy.mjs
ENTRYPOINT ["node", "scripts/verify-public-path.mjs"]
FROM postgres:17.11-bookworm@sha256:051f7b7b3abdd564d5d1bd1e8c4b9c1b6e77087d1dd22020ede611c096a272e0 AS postgres-tools
ENV NODE_ENV=production
WORKDIR /app
COPY --from=runtime-files /usr/local/bin/node /usr/local/bin/node
COPY --from=runtime-files /usr/local/LICENSE /usr/local/LICENSE
COPY --from=build --chown=postgres:postgres /app/LICENSE ./LICENSE
COPY --from=build --chown=postgres:postgres /app/scripts/postgres-backup.mjs ./scripts/postgres-backup.mjs
COPY --from=build --chown=postgres:postgres /app/scripts/postgres-restore.mjs ./scripts/postgres-restore.mjs
COPY --from=build --chown=postgres:postgres /app/scripts/postgres-url.mjs ./scripts/postgres-url.mjs
COPY --from=build --chown=postgres:postgres /app/scripts/postgres-operations.mjs ./scripts/postgres-operations.mjs
COPY --from=build --chown=postgres:postgres /app/scripts/postgres-process.mjs ./scripts/postgres-process.mjs
USER postgres
FROM postgres-tools AS db-backup
ENTRYPOINT ["node", "scripts/postgres-backup.mjs"]
FROM postgres-tools AS db-restore
ENTRYPOINT ["node", "scripts/postgres-restore.mjs"]
FROM gateway AS default