-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (36 loc) · 1.45 KB
/
Copy pathDockerfile
File metadata and controls
51 lines (36 loc) · 1.45 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
# syntax=docker/dockerfile:1
FROM node:22-bookworm-slim AS build
WORKDIR /app
COPY package.json package-lock.json ./
COPY packages ./packages
COPY apps ./apps
RUN npm ci
RUN npm run build -w @strait-command/shared && \
npm run build -w @strait-command/server
ARG NEXT_PUBLIC_WS_URL=http://localhost:4000
ENV NEXT_PUBLIC_WS_URL=$NEXT_PUBLIC_WS_URL
RUN npm run build -w @strait-command/web
# Intermediate image for docker-compose `target: web` (not the default final stage).
FROM node:22-bookworm-slim AS web
WORKDIR /app
ENV NODE_ENV=production
COPY --from=build /app/package.json /app/package-lock.json ./
COPY --from=build /app/packages ./packages
COPY --from=build /app/apps/web ./apps/web
COPY --from=build /app/node_modules ./node_modules
EXPOSE 3000
CMD ["npm", "run", "start", "-w", "@strait-command/web"]
# Default final stage — used by `docker build .` (e.g. Hugging Face Docker Spaces).
# docker-compose overrides PORT to 4000 for local API via environment.
FROM node:22-bookworm-slim AS api
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=7860
COPY scripts/healthcheck.cjs /healthcheck.cjs
COPY --from=build /app/package.json /app/package-lock.json ./
COPY --from=build /app/packages ./packages
COPY --from=build /app/apps/server ./apps/server
COPY --from=build /app/node_modules ./node_modules
EXPOSE 7860
HEALTHCHECK --interval=5s --timeout=4s --start-period=15s --retries=6 CMD ["node", "/healthcheck.cjs"]
CMD ["node", "apps/server/dist/index.js"]