advdoors/docker/Dockerfile
Maxim Snesarev 1c5cb18d30 Refactor product page and improve type safety in Footer and Header components
- Updated the product page to filter size options, ensuring only string types are included.
- Modified Footer and Header components to allow nullable types for phone, email, whatsapp, and footerText properties.
- Enhanced Dockerfile to optimize dependency installation and build process using Turbo for improved performance.
2026-04-02 22:39:37 +03:00

41 lines
1.2 KiB
Docker

FROM node:22-alpine AS base
RUN apk add --no-cache libc6-compat
RUN corepack enable && corepack prepare pnpm@10 --activate
WORKDIR /app
# Prune the monorepo for only the packages @advdoors/web needs
FROM base AS pruner
RUN pnpm add -g turbo@^2
COPY . .
RUN turbo prune @advdoors/web --docker
# Install dependencies using the pruned lockfile (cached unless deps change)
FROM base AS builder
COPY --from=pruner /app/out/json/ .
COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
RUN pnpm install --frozen-lockfile
# Copy pruned source and build via Turbo
COPY --from=pruner /app/out/full/ .
ENV NEXT_TELEMETRY_DISABLED=1
RUN pnpm turbo build --filter=@advdoors/web
# Production
FROM base AS runner
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nextjs
COPY --from=builder --chown=nextjs:nodejs /app/apps/web/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/apps/web/.next/static ./apps/web/.next/static
COPY --from=builder --chown=nextjs:nodejs /app/apps/web/public ./apps/web/public
USER nextjs
EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
CMD ["node", "apps/web/server.js"]