docker added

This commit is contained in:
2026-05-24 07:31:25 +03:30
parent 6591a52f27
commit a95ed67699
2 changed files with 34 additions and 0 deletions

7
.dockerignore Normal file
View File

@@ -0,0 +1,7 @@
node_modules
.next
npm-debug.log
Dockerfile
.dockerignore
.git
.env

27
Dockerfile Normal file
View File

@@ -0,0 +1,27 @@
# deps
FROM node:20-alpine AS deps
WORKDIR /app
COPY package*.json ./
RUN npm ci
# build
FROM node:20-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build
# run
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
# اگر از next start استفاده می‌کنی:
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/next.config.* ./ 2>/dev/null || true
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
EXPOSE 3000
CMD ["npm","start"]