taskflow-frontend / Dockerfile
Tahasaif3's picture
'change'
296bf3d
# Stage 1: Builder
FROM node:20-alpine AS builder
WORKDIR /app
# ๐Ÿ‘‡ Accept build-time variable
ARG NEXT_PUBLIC_API_URL
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
COPY package.json package-lock.json* ./
RUN npm ci
COPY . .
RUN npm run build
# Stage 2: Runner
FROM node:20-alpine AS runner
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
WORKDIR /app
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
RUN chown -R nextjs:nodejs /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
USER nextjs
EXPOSE 3000
CMD ["node", "server.js"]