Skip to content

Commit 2442db8

Browse files
committed
Use pnpm instead of yarn. Only use dep on prod.
1 parent d031c3d commit 2442db8

File tree

5 files changed

+1166
-4763
lines changed

5 files changed

+1166
-4763
lines changed

Dockerfile

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
FROM node:20-alpine as build
1+
FROM node:20-alpine as base
2+
ENV PNPM_HOME="/pnpm"
3+
ENV PATH="$PNPM_HOME:$PATH"
4+
RUN corepack enable
25
WORKDIR /app
3-
COPY package.json yarn.lock ./
46

5-
RUN yarn
7+
FROM base AS prod-deps
8+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
9+
--mount=type=bind,source=package.json,target=package.json \
10+
--mount=type=bind,source=pnpm-lock.yaml,target=pnpm-lock.yaml \
11+
pnpm install --prod --frozen-lockfile
612

7-
# Bundle app source
8-
COPY . .
9-
10-
RUN yarn build
13+
FROM base AS build
14+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
15+
--mount=type=bind,source=package.json,target=package.json \
16+
--mount=type=bind,source=pnpm-lock.yaml,target=pnpm-lock.yaml \
17+
pnpm install --frozen-lockfile
18+
COPY . /app
19+
RUN pnpm run build
1120

1221
FROM node:20-alpine
1322

@@ -17,7 +26,7 @@ WORKDIR /app
1726

1827
RUN apk add git python3 make g++
1928

20-
COPY --chown=node:node --from=build /app/node_modules node_modules
29+
COPY --from=prod-deps /app/node_modules node_modules
2130
COPY --chown=node:node --from=build /app/dist dist
2231
COPY --chown=node:node --from=build /app/package.json ./
2332

package.json

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,22 @@
1010
"test": "jest",
1111
"start": "node dist/index.js"
1212
},
13+
"packageManager": "[email protected]",
1314
"dependencies": {
14-
"aws-sdk": "^2.814.0",
15-
"express": "^4.17.1",
16-
"hash-sum": "^1.0.2",
15+
"aws-sdk": "^2.1506.0",
16+
"express": "^4.18.2",
17+
"hash-sum": "^2.0.0",
1718
"p-queue": "^7.4.1",
18-
"recursive-readdir": "^2.2.2",
19-
"rimraf": "^2.6.3",
19+
"recursive-readdir": "^2.2.3",
20+
"rimraf": "^5.0.5",
2021
"url": "^0.11.0",
2122
"zlib": "^1.0.5"
2223
},
2324
"devDependencies": {
24-
"@types/express": "^4.16.1",
25-
"@types/hash-sum": "^1.0.0",
26-
"@types/jest": "^24.0.6",
27-
"@types/node": "^13.11.1",
28-
"@types/node-fetch": "^2.1.4",
29-
"@types/recursive-readdir": "^2.2.0",
30-
"@types/rimraf": "^2.0.2",
31-
"jest": "^24.1.0",
32-
"lambda-git": "0.1.1",
33-
"node-fetch": "^2.3.0",
34-
"ts-jest": "^24.0.0",
25+
"@types/express": "^4.17.21",
26+
"@types/hash-sum": "^1.0.2",
27+
"@types/node": "^20.10.0",
28+
"@types/recursive-readdir": "^2.2.4",
3529
"tsc-watch": "^6.0.4",
3630
"typescript": "^5.2.2"
3731
}

0 commit comments

Comments
 (0)