@@ -0,0 +1,13 @@
|
|||||||
|
node_modules
|
||||||
|
.next
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
*.md
|
||||||
|
.env*
|
||||||
|
npm-debug.log*
|
||||||
|
.DS_Store
|
||||||
|
coverage
|
||||||
|
.cursor
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
*.log
|
||||||
+24
-71
@@ -1,104 +1,57 @@
|
|||||||
# ------------------------
|
# syntax=docker/dockerfile:1
|
||||||
# Base image
|
|
||||||
# ------------------------
|
|
||||||
FROM node:22-alpine AS base
|
|
||||||
|
|
||||||
RUN apk add --no-cache tzdata \
|
|
||||||
&& cp /usr/share/zoneinfo/Asia/Tehran /etc/localtime \
|
|
||||||
&& echo "Asia/Tehran" > /etc/timezone
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# ------------------------
|
# ------------------------
|
||||||
# Dependencies stage
|
# Dependencies
|
||||||
# ------------------------
|
# ------------------------
|
||||||
FROM base AS deps
|
FROM node:22-alpine AS deps
|
||||||
|
|
||||||
RUN apk add --no-cache libc6-compat git
|
RUN apk add --no-cache libc6-compat git
|
||||||
|
|
||||||
COPY package*.json ./
|
WORKDIR /app
|
||||||
|
|
||||||
RUN npm ci
|
COPY package.json package-lock.json ./
|
||||||
|
|
||||||
|
RUN --mount=type=cache,target=/root/.npm \
|
||||||
|
npm ci
|
||||||
|
|
||||||
# ------------------------
|
# ------------------------
|
||||||
# Builder stage
|
# Builder
|
||||||
# ------------------------
|
# ------------------------
|
||||||
FROM base AS builder
|
FROM node:22-alpine AS builder
|
||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
|
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN NEXT_TELEMETRY_DISABLED=1 npm run build -- --no-lint || true
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
# ------------------------
|
# ------------------------
|
||||||
# Runner stage (production)
|
# Runner (production)
|
||||||
# ------------------------
|
# ------------------------
|
||||||
FROM base AS runner
|
FROM node:22-alpine AS runner
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production \
|
||||||
ENV NEXT_TELEMETRY_DISABLED=1
|
NEXT_TELEMETRY_DISABLED=1 \
|
||||||
ENV PORT=3000
|
PORT=3000 \
|
||||||
ENV HOSTNAME="0.0.0.0"
|
HOSTNAME=0.0.0.0 \
|
||||||
|
TZ=Asia/Tehran
|
||||||
|
|
||||||
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
RUN addgroup -S appgroup \
|
||||||
|
&& adduser -S appuser -G appgroup \
|
||||||
RUN mkdir .next && chown appuser:appgroup .next
|
&& mkdir .next \
|
||||||
|
&& chown appuser:appgroup .next
|
||||||
|
|
||||||
COPY --from=builder --chown=appuser:appgroup /build/.next/standalone ./
|
COPY --from=builder --chown=appuser:appgroup /build/.next/standalone ./
|
||||||
COPY --from=builder --chown=appuser:appgroup /build/.next/static ./.next/static
|
COPY --from=builder --chown=appuser:appgroup /build/.next/static ./.next/static
|
||||||
COPY --from=builder --chown=appuser:appgroup /build/public ./public
|
COPY --from=builder --chown=appuser:appgroup /build/public ./public
|
||||||
COPY --from=builder --chown=appuser:appgroup /build/package.json ./package.json
|
|
||||||
|
|
||||||
USER appuser
|
USER appuser
|
||||||
|
|
||||||
# expose port
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
CMD ["node", "server.js"]
|
CMD ["node", "server.js"]
|
||||||
|
|
||||||
|
|
||||||
# FROM node:22-alpine AS base
|
|
||||||
|
|
||||||
# RUN apk add --no-cache tzdata && \
|
|
||||||
# cp /usr/share/zoneinfo/Asia/Tehran /etc/localtime && \
|
|
||||||
# echo "Asia/Tehran" > /etc/timezone
|
|
||||||
|
|
||||||
# WORKDIR /app
|
|
||||||
|
|
||||||
# FROM base AS deps
|
|
||||||
# RUN apk add --no-cache libc6-compat git
|
|
||||||
# COPY package*.json ./
|
|
||||||
# RUN npm ci --only=production --ignore-scripts
|
|
||||||
|
|
||||||
# FROM base AS builder
|
|
||||||
# WORKDIR /build
|
|
||||||
# COPY --from=deps /app/node_modules ./node_modules
|
|
||||||
# COPY . .
|
|
||||||
# RUN npm run build && npm ci --only=production --ignore-scripts
|
|
||||||
|
|
||||||
# FROM base AS runner
|
|
||||||
# WORKDIR /app
|
|
||||||
|
|
||||||
# ENV NODE_ENV=production
|
|
||||||
# ENV NEXT_TELEMETRY_DISABLED=1
|
|
||||||
|
|
||||||
# RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
|
||||||
# RUN mkdir .next && chown appuser:appgroup .next
|
|
||||||
|
|
||||||
# COPY --from=builder --chown=appuser:appgroup /build/.next/standalone ./
|
|
||||||
# COPY --from=builder --chown=appuser:appgroup /build/.next/static ./.next/static
|
|
||||||
# COPY --from=builder --chown=appuser:appgroup /build/public ./public
|
|
||||||
# COPY --from=builder --chown=appuser:appgroup /build/package.json ./package.json
|
|
||||||
|
|
||||||
# USER appuser
|
|
||||||
|
|
||||||
# EXPOSE 3000
|
|
||||||
# ENV PORT=3000
|
|
||||||
# ENV HOSTNAME="0.0.0.0"
|
|
||||||
|
|
||||||
# CMD ["node", "server.js"]
|
|
||||||
Reference in New Issue
Block a user