-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (27 loc) · 823 Bytes
/
Copy pathDockerfile
File metadata and controls
31 lines (27 loc) · 823 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
31
ARG NODE_VERSION=23.6-alpine3.20
# Base
FROM node:${NODE_VERSION} AS base
RUN mkdir -p /mustachebash
WORKDIR /mustachebash
COPY package.json package-lock.json ./
# Build dependencies
FROM base AS build-deps
# https://docs.docker.com/build/guide/mounts/
RUN --mount=type=cache,target=/root/.npm \
npm ci
# Build
FROM build-deps AS build
# https://docs.docker.com/build/guide/mounts/
RUN --mount=type=cache,target=/root/.npm \
--mount=type=bind,source=tsconfig.json,target=tsconfig.json \
--mount=type=bind,source=lib,target=lib \
npm run build; exit 0
# Production
FROM base AS production
# https://docs.docker.com/build/guide/mounts/
RUN --mount=type=cache,target=/root/.npm \
NODE_ENV=production npm ci
USER node
COPY --from=build /mustachebash/dist ./dist
EXPOSE 4000
CMD npm --silent --no-update-notifier start