Skip to content

Commit 7e07566

Browse files
committed
copying node_modules instead of reinstalling them
1 parent 1e9c8a3 commit 7e07566

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

Dockerfile

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Builder Stage
32
FROM node:22-alpine AS builder
43

@@ -31,32 +30,21 @@ FROM node:22-alpine
3130

3231
WORKDIR /app
3332

34-
# Environnement variables
33+
# Environment variables
3534
ENV NODE_ENV=production \
3635
HOST=0.0.0.0 \
37-
PORT=3000
38-
39-
# install tools
40-
RUN npm install -g pnpm npm-run-all && \
41-
apk add --no-cache git && \
42-
git init
36+
PORT=3000 \
37+
VITE_PORT=3000
4338

44-
# copy files needed for installing dependencies
45-
COPY --from=builder /app/package.json ./
46-
COPY --from=builder /app/pnpm-lock.yaml ./
47-
COPY --from=builder /app/run-jiti.js ./
48-
COPY --from=builder /app/prisma ./prisma
49-
COPY --from=builder /app/src/features/build-info ./src/features/build-info
50-
51-
# copy environment configuration
52-
# TODO: Replace with environment variables or secrets in production
39+
# install pnpm
40+
RUN npm install -g pnpm npm-run-all
5341
COPY .env ./
5442

55-
# install production dependencies (this will run prisma generate)
56-
RUN pnpm install --frozen-lockfile
57-
58-
# copy build artifacts after installation
43+
## copy output build and package.json from builder
5944
COPY --from=builder /app/.output ./.output
45+
COPY --from=builder /app/package.json ./package.json
46+
COPY --from=builder /app/pnpm-lock.yaml ./pnpm-lock.yaml
47+
COPY --from=builder /app/node_modules ./node_modules
6048

6149
EXPOSE 3000
6250

0 commit comments

Comments
 (0)