fix: create docker networks

This commit is contained in:
2026-05-14 17:20:15 +04:00
parent 42fb5f40f9
commit 7d75866803
4 changed files with 31 additions and 17 deletions
+13 -9
View File
@@ -4,17 +4,21 @@ FROM node:22-alpine AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
# Copie des fichiers de dépendances
COPY package.json yarn.lock ./
# Installation avec Yarn
RUN yarn install --frozen-lockfile
# ─── Étape 2 : build de production ───────────────────────────────────────────
FROM node:22-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Variables nécessaires au build (publiques uniquement — pas de secrets)
# Variables nécessaires au build
ARG NEXT_PUBLIC_DIRECTUS_API_URL
ARG NEXT_PUBLIC_DIRECTUS_API_WS_URL
ARG NEXT_PUBLIC_SENTRY_DSN
@@ -25,7 +29,8 @@ ENV NEXT_PUBLIC_DIRECTUS_API_WS_URL=$NEXT_PUBLIC_DIRECTUS_API_WS_URL
ENV NEXT_PUBLIC_SENTRY_DSN=$NEXT_PUBLIC_SENTRY_DSN
ENV SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN
RUN npm run build
# Build Next.js
RUN yarn build
# ─── Étape 3 : image de production minimale ──────────────────────────────────
FROM node:22-alpine AS runner
@@ -33,20 +38,19 @@ FROM node:22-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=3000
ENV PORT=4000
ENV HOSTNAME=0.0.0.0
# Utilisateur non-root pour la sécurité
# Utilisateur non-root
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nextjs
# Le mode standalone copie uniquement ce qui est nécessaire à l'exécution
# Fichiers nécessaires au mode standalone
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 3000
EXPOSE 4000
# server.js généré par output: 'standalone'
CMD ["node", "server.js"]