Add Dockerfile

master
Amir Hossein Khademi 2024-02-16 18:34:24 +03:30
parent bfd480ed91
commit fe78c7ad67
1 changed files with 29 additions and 0 deletions

29
Dockerfile 100644
View File

@ -0,0 +1,29 @@
FROM node:20-alpine3.18 AS deps
RUN apk add --no-cache libc6-compat
RUN npm install -g pnpm
WORKDIR /app
COPY package.json ./
RUN npm install --force --production
FROM node:20-alpine3.18 AS builder
WORKDIR /app
ARG NODE_ENV=production
COPY . .
COPY --from=deps /app/node_modules ./node_modules
RUN npm run build
FROM node:20-alpine3.18 AS runner
WORKDIR /app
ARG NODE_ENV=production
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/.env.production ./.env.production
COPY --from=builder /app/next.config.js ./next.config.js
EXPOSE 3000
ENV PORT 3000
CMD ["node_modules/.bin/next", "start"]