Skip to content

Commit d8c5b13

Browse files
committed
Update Dockerfile
fix target production build
1 parent c761be8 commit d8c5b13

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Dockerfile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,24 @@ FROM base AS build
2020
ENV NODE_ENV=production
2121
# Install dependencies
2222
COPY package*.json ./
23-
RUN npm ci
23+
# Skip all lifecycle scripts including husky
24+
RUN npm install --ignore-scripts
2425
# Copy source code
2526
COPY . .
27+
# Build the application
28+
RUN npm run build
2629

2730
# Production stage
2831
FROM node:22-alpine AS production
2932
ENV NODE_ENV=production
3033
WORKDIR /app
31-
# Copy built assets from build stage
34+
# Copy built assets and package files from build stage
3235
COPY --from=build /app/dist ./dist
3336
COPY --from=build /app/package.json ./package.json
37+
COPY --from=build /app/package-lock.json ./package-lock.json
3438
# Install only production dependencies
35-
RUN npm ci --omit=dev
39+
RUN npm install --omit=dev --ignore-scripts
3640
# Expose production port
3741
EXPOSE 4321
38-
# Start production server
39-
CMD ["node", "./dist/server/entry.mjs"]
42+
# Start production server using Astro preview
43+
CMD ["npm", "run", "preview", "--", "--host"]

0 commit comments

Comments
 (0)