43 lines
1011 B
Docker
43 lines
1011 B
Docker
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# کپی package.json و package-lock.json
|
|
COPY package*.json ./
|
|
|
|
# نصب وابستگیها با force (برای رفع مشکل TailwindCSS)
|
|
RUN npm install --force
|
|
|
|
# کپی کل پروژه
|
|
COPY . .
|
|
|
|
# متغیر محیطی برای جلوگیری از خطای location
|
|
ENV NEXT_PUBLIC_SITE_URL=https://modstagram.com
|
|
ENV NODE_ENV=production
|
|
|
|
# Build (fail loudly on error)
|
|
RUN npm run build
|
|
|
|
# مرحله اجرا
|
|
FROM node:20-alpine AS runner
|
|
|
|
WORKDIR /app
|
|
|
|
# کپی فایلهای build شده
|
|
COPY --from=builder /app/.next ./.next
|
|
COPY --from=builder /app/public ./public
|
|
COPY --from=builder /app/package*.json ./
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
|
|
# فایلهای config رو هم کپی کن
|
|
COPY --from=builder /app/next.config.ts ./
|
|
COPY --from=builder /app/next-sitemap.config.js ./
|
|
|
|
ENV NODE_ENV=production
|
|
ENV HOST=0.0.0.0
|
|
ENV PORT=3001
|
|
ENV NEXT_PUBLIC_SITE_URL=https://modstagram.com
|
|
|
|
EXPOSE 3001
|
|
|
|
CMD ["npm", "start"] |