Skip to content

Commit 7d4a1de

Browse files
committed
include package.json early in dockerfile
1 parent f860b07 commit 7d4a1de

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Dockerfile

+4-6
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ FROM node:21.7.3-alpine as base
22

33
WORKDIR /app
44

5-
RUN corepack enable
65
RUN apk add --no-cache python3 make g++
76

8-
COPY pnpm-lock.yaml ./
7+
COPY package.json pnpm-lock.yaml ./
8+
RUN corepack enable
99

1010
RUN pnpm fetch
1111

1212
FROM base as build
1313

1414
WORKDIR /app
1515

16-
COPY tsup.config.ts package.json ./
16+
COPY tsup.config.ts ./
1717
COPY src ./src
1818

1919
RUN pnpm install --frozen-lockfile --offline && \
@@ -23,7 +23,6 @@ FROM base as production-dependencies
2323

2424
WORKDIR /app
2525

26-
COPY package.json ./
2726
RUN pnpm prune --prod && \
2827
pnpm install --production --frozen-lockfile --offline && \
2928
pnpm store prune
@@ -34,8 +33,7 @@ WORKDIR /app
3433

3534
COPY --from=production-dependencies --chown=node /app/node_modules ./node_modules
3635
COPY --from=build --chown=node /app/dist ./
37-
38-
RUN echo '{"type":"module"}' > package.json
36+
COPY --from=base --chown=node /app/package.json ./
3937

4038
USER node
4139

0 commit comments

Comments
 (0)