Some checks failed
Build & Deploy / 🔍 Prepare Environment (push) Successful in 5s
Build & Deploy / 🧪 QA (push) Successful in 5m58s
Build & Deploy / 🏗️ Build (push) Successful in 7m8s
Build & Deploy / 🚀 Deploy (push) Failing after 16s
Build & Deploy / ⚡ PageSpeed (push) Has been skipped
Build & Deploy / 🔔 Notifications (push) Successful in 2s
60 lines
1.8 KiB
Docker
60 lines
1.8 KiB
Docker
# Start from the pre-built Nextjs Base image
|
|
FROM registry.infra.mintel.me/mintel/nextjs:latest AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Ensure we are in a clean environment and remove any stale files from the base image
|
|
RUN rm -rf packages apps pnpm-workspace.yaml 2>/dev/null || true
|
|
|
|
# Build-time environment variables for Next.js
|
|
ARG NEXT_PUBLIC_BASE_URL
|
|
ARG UMAMI_API_ENDPOINT
|
|
ARG NEXT_PUBLIC_TARGET
|
|
ARG DIRECTUS_URL
|
|
|
|
ENV NEXT_PUBLIC_BASE_URL=$NEXT_PUBLIC_BASE_URL
|
|
ENV UMAMI_API_ENDPOINT=$UMAMI_API_ENDPOINT
|
|
ENV NEXT_PUBLIC_TARGET=$NEXT_PUBLIC_TARGET
|
|
ENV DIRECTUS_URL=$DIRECTUS_URL
|
|
ENV CI=true
|
|
ENV SENTRY_SUPPRESS_TURBOPACK_WARNING=1
|
|
|
|
# Enable pnpm
|
|
RUN corepack enable
|
|
|
|
# Set pnpm home and store directory for caching
|
|
ENV PNPM_HOME="/pnpm"
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
RUN mkdir -p /pnpm/store
|
|
|
|
# Copy workspace configuration and manifests for better caching
|
|
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json .npmrc ./
|
|
COPY apps/web/package.json ./apps/web/package.json
|
|
|
|
# Install dependencies with cache mount and NPM_TOKEN secret
|
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
|
--mount=type=secret,id=NPM_TOKEN \
|
|
export NPM_TOKEN=$(cat /run/secrets/NPM_TOKEN) && \
|
|
pnpm install --no-frozen-lockfile
|
|
|
|
# Copy source
|
|
COPY . .
|
|
|
|
# Build the app with cache mount
|
|
RUN --mount=type=cache,target=/app/apps/web/.next/cache \
|
|
pnpm --filter @mintel/web build
|
|
|
|
# Production image
|
|
FROM registry.infra.mintel.me/mintel/runtime:latest AS runner
|
|
WORKDIR /app
|
|
|
|
# Copy standalone output and static files (Monorepo paths)
|
|
COPY --from=builder --chown=nextjs:nodejs /app/apps/web/public ./apps/web/public
|
|
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
|
|
|
|
USER nextjs
|
|
|
|
WORKDIR /app/apps/web
|
|
CMD ["node", "server.js"]
|