Files
at-mintel/packages/infra/docker/Dockerfile.gatekeeper
Marc Mintel 1a94465dba
Some checks failed
Monorepo Pipeline / 🧪 Quality Assurance (push) Successful in 2m34s
Monorepo Pipeline / 🚀 Release (push) Successful in 2m40s
Monorepo Pipeline / 🐳 Build & Push Images (push) Failing after 3m6s
feat: streamline Docker builds with .dockerignore and pass NPM_TOKEN as a build secret for pnpm install.
2026-02-03 22:13:34 +01:00

43 lines
1.1 KiB
Docker

FROM node:20-alpine AS base
RUN apk add --no-cache libc6-compat curl
WORKDIR /app
# Enable pnpm
RUN corepack enable pnpm
# Step 2: Install dependencies
# We copy everything first because we have a .dockerignore
# and we need the workspace structure for pnpm to work correctly
COPY . .
# Use a secret for NPM_TOKEN to authenticate with private registry
RUN --mount=type=cache,target=/root/.local/share/pnpm/store/v3 \
--mount=type=secret,id=NPM_TOKEN \
export NPM_TOKEN=$(cat /run/secrets/NPM_TOKEN) && \
pnpm i --frozen-lockfile
# Copy source
COPY . .
# Build Gatekeeper
RUN pnpm --filter @mintel/gatekeeper build
# Runner
FROM base AS runner
WORKDIR /app
ENV NODE_ENV=production
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY --from=builder /app/packages/gatekeeper/public ./packages/gatekeeper/public
COPY --from=builder /app/packages/gatekeeper/.next/standalone ./
COPY --from=builder /app/packages/gatekeeper/.next/static ./packages/gatekeeper/.next/static
USER nextjs
EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
CMD ["node", "packages/gatekeeper/server.js"]