Commit 8154e66 1 parent 7c67b6c commit 8154e66 Copy full SHA for 8154e66
File tree 2 files changed +23
-5
lines changed
2 files changed +23
-5
lines changed Original file line number Diff line number Diff line change 1
- FROM node:20.10-alpine3.19
1
+ ARG NODE_VERSION=20.10-alpine3.19
2
+
3
+ # Base
4
+ FROM node:${NODE_VERSION} as base
2
5
RUN mkdir -p /mustachebash
3
6
WORKDIR /mustachebash
4
7
COPY package.json package-lock.json ./
5
- RUN NODE_ENV=production npm ci --include=prod --no-optional && \
6
- npm --silent cache clean --force
7
8
8
- COPY lib lib
9
+ # Build
10
+ FROM base as build
11
+ # https://docs.docker.com/build/guide/mounts/
12
+ RUN --mount=type=cache,target=/root/.npm \
13
+ --mount=type=bind,source=tsconfig.json,target=tsconfig.json \
14
+ --mount=type=bind,source=lib,target=lib \
15
+ npm ci && \
16
+ npm run build; exit 0
17
+
18
+ # Production
19
+ FROM base as production
20
+ # https://docs.docker.com/build/guide/mounts/
21
+ RUN --mount=type=cache,target=/root/.npm \
22
+ NODE_ENV=production npm ci
23
+ USER node
24
+ COPY --from=build /mustachebash/dist ./dist
9
25
EXPOSE 4000
10
- CMD npm start
26
+ CMD npm --silent --no-update-notifier start
27
+
Original file line number Diff line number Diff line change 8
8
"author" : " Wild Feather LLC" ,
9
9
"scripts" : {
10
10
"dev" : " tsx watch --clear-screen=false lib/index.ts" ,
11
+ "build" : " rm -rf dist && tsc" ,
11
12
"test" : " eslint . && tsc --noEmit" ,
12
13
"start" : " node ." ,
13
14
"check:updates" : " ncu" ,
You can’t perform that action at this time.
0 commit comments