File tree Expand file tree Collapse file tree 4 files changed +31
-19
lines changed
Expand file tree Collapse file tree 4 files changed +31
-19
lines changed Original file line number Diff line number Diff line change 1- FROM node:18 -alpine AS builder
2- ENV PNPM_VERSION=9.0.2
1+ FROM node:22 -alpine AS builder
2+ ENV PNPM_VERSION=10.24.0
33
44RUN corepack enable && \
55 corepack prepare pnpm@${PNPM_VERSION} --activate && \
66 pnpm config set store-dir /pnpm-store
77
8+ RUN mkdir -p /app && chown node:node /app
9+
10+ USER node
11+
812WORKDIR /app
913
1014# Files required by pnpm install
11- COPY package.json pnpm-lock.yaml tsdown.config.js tsconfig.json /app/
15+ COPY --chown=node package.json pnpm-lock.yaml tsdown.config.js tsconfig.json /app/
1216
1317RUN pnpm install --frozen-lockfile
1418
15- # Bundle app source
16- COPY src src
17- COPY vendor vendor
18-
19- RUN pnpm build:server
20-
21-
22- FROM node:18-alpine
23- WORKDIR /app
19+ COPY --chown=node src /app/src
20+ COPY --chown=node vendor /app/vendor
2421
25- RUN adduser -D -u 8000 commercetools
2622
27- COPY --from=builder /app/dist /app
23+ # Build server bundle
24+ RUN pnpm build:server
2825
2926EXPOSE 8989
30- ENV HTTP_SERVER_PORT 8989
27+ ENV HTTP_SERVER_PORT= 8989
3128
32- CMD ["node" , "./server.js " ]
29+ CMD ["node" , "./dist/ server.mjs " ]
Original file line number Diff line number Diff line change 1+ version : " 3.9"
2+
3+ services :
4+ server :
5+ build :
6+ context : .
7+ dockerfile : Dockerfile
8+ ports :
9+ - " 8989:8989"
10+ environment :
11+ NODE_ENV : production
12+ PORT : 8989
13+ restart : unless-stopped
Original file line number Diff line number Diff line change 2020 ],
2121 "scripts" : {
2222 "build" : " tsdown" ,
23- "build:server" : " esbuild src/server.ts --bundle --outfile=dist/server.js --platform=node" ,
23+ "build:server" : " tsdown src/server.ts --platform=node" ,
2424 "check" : " biome check && tsc" ,
2525 "format" : " biome check --fix" ,
2626 "lint" : " biome check" ,
6565 "typescript" : " 5.9.3" ,
6666 "vitest" : " 4.0.13"
6767 },
68- "packageManager" : " pnpm@10.8 .0" ,
68+ "packageManager" : " pnpm@10.24 .0" ,
6969 "engines" : {
7070 "node" : " >=18" ,
71- "pnpm" : " >=9.0.2 "
71+ "pnpm" : " >=10.8.0 "
7272 },
7373 "publishConfig" : {
7474 "access" : " public" ,
Original file line number Diff line number Diff line change @@ -11,4 +11,6 @@ let port = 3000;
1111if ( process . env . HTTP_SERVER_PORT )
1212 port = Number . parseInt ( process . env . HTTP_SERVER_PORT , 10 ) ;
1313
14+ // biome-ignore lint: lint/correctness/noConsoleLog
15+ console . info ( "Starting commercetools-mock on http://localhost:" + port ) ;
1416instance . runServer ( port ) ;
You can’t perform that action at this time.
0 commit comments