-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathDockerfile
38 lines (27 loc) · 862 Bytes
/
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
FROM node:20-alpine AS builder
COPY ./ /build/
WORKDIR /build
ENV COREPACK_ENABLE_STRICT=0
ENV CYPRESS_INSTALL_BINARY=0
RUN --mount=type=cache,target=/root/.npm/_cacache/ \
--mount=type=cache,target=/root/.local/share/pnpm/store \
npm install -g pnpm@10 && \
pnpm install --frozen-lockfile && \
pnpm run build
FROM node:20-alpine AS production
WORKDIR /app
ARG GIT_SHA
ENV GIT_SHA=${GIT_SHA}
ENV NITRO_HOST=0.0.0.0
ENV NITRO_PORT=4000
RUN --mount=type=cache,target=/root/.npm/_cacache/ \
npm install -g [email protected]
COPY --from=builder /build/.output ./.output/
COPY --from=builder /build/ecosystem.config.cjs ./
COPY --from=builder /build/package.json ./
COPY health.sh ./
RUN chmod +x health.sh
EXPOSE ${NITRO_PORT}
CMD ["pm2-runtime", "ecosystem.config.cjs"]
HEALTHCHECK --start-period=30s --retries=2 \
CMD ["/app/health.sh"]