2026-03-21 17:33:39 +03:30
|
|
|
FROM docker.iranserver.com/node:20-bookworm-slim AS base
|
|
|
|
|
|
|
|
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
|
|
|
|
|
|
|
|
# Debian mirrors (Iranian)
|
|
|
|
|
RUN rm -f /etc/apt/sources.list /etc/apt/sources.list.d/* && \
|
|
|
|
|
printf '%s\n' \
|
|
|
|
|
'deb https://mirror-linux.runflare.com/debian/ bookworm main contrib non-free non-free-firmware' \
|
|
|
|
|
'deb https://mirror-linux.runflare.com/debian/ bookworm-updates main contrib non-free non-free-firmware' \
|
|
|
|
|
'deb https://mirror-linux.runflare.com/debian-security/ bookworm-security main contrib non-free non-free-firmware' \
|
|
|
|
|
'' \
|
|
|
|
|
'deb [trusted=yes] https://mirror2.chabokan.net/debian bookworm main contrib non-free non-free-firmware' \
|
|
|
|
|
'deb [trusted=yes] https://mirror2.chabokan.net/debian-security bookworm-security main contrib non-free non-free-firmware' \
|
|
|
|
|
'' \
|
|
|
|
|
'deb http://mirror.iranserver.com/debian/ bookworm main contrib non-free non-free-firmware' \
|
|
|
|
|
'deb-src http://mirror.iranserver.com/debian/ bookworm main contrib non-free non-free-firmware' \
|
|
|
|
|
> /etc/apt/sources.list
|
|
|
|
|
|
|
|
|
|
# npm mirrors (Iranian)
|
|
|
|
|
RUN npm config set registry https://package-mirror.liara.ir/repository/npm/ && \
|
|
|
|
|
npm config set @runflare:registry https://mirror-npm.runflare.com/ && \
|
|
|
|
|
npm config set @chabokan:registry https://mirror2.chabokan.net/npm/ && \
|
|
|
|
|
npm config set strict-ssl false && \
|
|
|
|
|
npm config set fetch-retries 5 && \
|
|
|
|
|
npm config set fetch-retry-mintimeout 20000
|
|
|
|
|
|
|
|
|
|
# ---- deps stage ----
|
|
|
|
|
FROM base AS deps
|
|
|
|
|
|
2026-02-19 01:15:36 +03:30
|
|
|
WORKDIR /app
|
|
|
|
|
|
2026-03-21 17:33:39 +03:30
|
|
|
COPY package.json package-lock.json ./
|
|
|
|
|
RUN npm ci
|
2026-02-19 01:15:36 +03:30
|
|
|
|
2026-03-21 17:33:39 +03:30
|
|
|
# ---- build stage ----
|
|
|
|
|
FROM base AS builder
|
2026-02-19 01:15:36 +03:30
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
|
|
|
COPY . .
|
|
|
|
|
|
2026-03-21 17:33:39 +03:30
|
|
|
ENV NODE_ENV=production
|
|
|
|
|
|
2026-02-19 01:15:36 +03:30
|
|
|
RUN npm run build
|
|
|
|
|
|
2026-03-21 17:33:39 +03:30
|
|
|
# ---- production stage ----
|
|
|
|
|
FROM base AS runner
|
|
|
|
|
|
2026-02-19 01:15:36 +03:30
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
ENV NODE_ENV=production
|
2026-03-21 17:39:28 +03:30
|
|
|
ENV PORT=9031
|
2026-03-21 17:33:39 +03:30
|
|
|
ENV HOSTNAME=0.0.0.0
|
2026-02-19 01:15:36 +03:30
|
|
|
|
2026-03-21 17:33:39 +03:30
|
|
|
RUN addgroup --system --gid 1001 nodejs && \
|
|
|
|
|
adduser --system --uid 1001 nextjs
|
2026-02-19 01:15:36 +03:30
|
|
|
|
2026-03-21 17:33:39 +03:30
|
|
|
COPY --from=builder /app/public ./public
|
2026-02-19 01:15:36 +03:30
|
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
|
|
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
|
|
|
|
|
|
|
|
|
USER nextjs
|
|
|
|
|
|
2026-03-21 17:39:28 +03:30
|
|
|
EXPOSE 9031
|
2026-02-19 01:15:36 +03:30
|
|
|
|
|
|
|
|
CMD ["node", "server.js"]
|