-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (24 loc) · 760 Bytes
/
Dockerfile
File metadata and controls
30 lines (24 loc) · 760 Bytes
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
FROM node:24-slim AS base
WORKDIR /usr/backend
RUN apt-get update && \
apt-get install -y --no-install-recommends curl && \
rm -rf /var/lib/apt/lists/*
COPY tsconfig.json .
COPY package.json .
COPY package-lock.json .
EXPOSE 80
HEALTHCHECK --interval=5s --timeout=3s --start-period=10s --retries=5 \
CMD curl -f -s http://localhost/public/health || exit 1
FROM base AS dev
RUN --mount=type=cache,target=/root/.npm npm ci
CMD [ "npm", "run", "watch" ]
FROM base AS build
COPY tsconfig.build.json .
RUN --mount=type=cache,target=/root/.npm npm ci
COPY src ./src
RUN npm run build
FROM base AS prod
ENV NODE_ENV=production
RUN --mount=type=cache,target=/root/.npm npm ci --omit=dev
COPY --from=build /usr/backend/dist .
CMD [ "node", "index.js" ]