Skip to content

Commit

Permalink
🦑 refactor: remove --omit=dev from npm ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ad956 committed Oct 10, 2024
1 parent 1a00237 commit ebe5c42
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18.17.0-alpine AS base
FROM node:18-alpine AS base

# Install dependencies only when needed
FROM base AS deps
Expand All @@ -9,7 +9,7 @@ WORKDIR /app
COPY package*.json ./

# Install dependencies
RUN npm ci --only=production
RUN npm ci

# Rebuild the source code only when needed
FROM base AS builder
Expand Down Expand Up @@ -39,20 +39,16 @@ ENV NODE_ENV=production
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

# Copy only necessary files
# Copy necessary files
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static

# Optimize for production
RUN npm prune --production

USER nextjs

EXPOSE 3000

ENV PORT=3000
ENV HOSTNAME="0.0.0.0"

# Use a multi-stage build to reduce layers
CMD ["node", "server.js"]

0 comments on commit ebe5c42

Please sign in to comment.