fix: create docker networks
This commit is contained in:
@@ -4,6 +4,5 @@ node_modules
|
||||
.next
|
||||
.git
|
||||
.env
|
||||
yarn.lock
|
||||
tasks/
|
||||
*.md
|
||||
|
||||
+12
-6
@@ -1,5 +1,11 @@
|
||||
DIRECTUS_API_URL=http://0.0.0.0:8055
|
||||
DIRECTUS_API_WS_URL=ws://0.0.0.0:8055/websocket
|
||||
# URL interne Docker (server-side Next.js → conteneur Directus via le réseau Docker)
|
||||
DIRECTUS_API_URL=http://directus:8055
|
||||
DIRECTUS_API_WS_URL=ws://directus:8055/websocket
|
||||
|
||||
# URL publique (navigateur → Directus exposé sur l'hôte)
|
||||
NEXT_PUBLIC_DIRECTUS_API_URL=http://0.0.0.0:8055
|
||||
NEXT_PUBLIC_DIRECTUS_API_WS_URL=ws://0.0.0.0:8055/websocket
|
||||
|
||||
APP_TITLE=constitution de karukera
|
||||
APP_FOOTER_TEXT=organisation ka internationale (oki)
|
||||
APP_FOOTER_URL=https://o-k-i.net
|
||||
@@ -7,16 +13,16 @@ NEXT_PUBLIC_APP_FOOTER_TEXT=organisation ka internationale (oki)
|
||||
NEXT_PUBLIC_APP_FOOTER_URL=https://o-k-i.net
|
||||
|
||||
# AUTH
|
||||
NEXTAUTH_URL=http://0.0.0.0:3000
|
||||
NEXTAUTH_URL=http://0.0.0.0:4000
|
||||
NEXTAUTH_SECRET=NEXTAUTH_SECRET
|
||||
USER_ROLE=DIRECTUS_USER_ROLE_ID
|
||||
NEXT_PUBLIC_URL=http://0.0.0.0:3000
|
||||
NEXT_PUBLIC_DIRECTUS_API_URL=$DIRECTUS_API_URL
|
||||
NEXT_PUBLIC_DIRECTUS_API_WS_URL=$DIRECTUS_API_WS_URL
|
||||
NEXT_PUBLIC_URL=http://0.0.0.0:4000
|
||||
|
||||
# COMMENTS
|
||||
COMMENTS_PER_PAGE=5
|
||||
|
||||
PASSWORD_RESET_URL_ALLOW_LIST=http://0.0.0.0:4000/reset-password
|
||||
|
||||
# WEBSOCKET
|
||||
NEXT_PUBLIC_DISABLE_WEBSOCKET=false
|
||||
|
||||
|
||||
+13
-9
@@ -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"]
|
||||
|
||||
+6
-1
@@ -8,6 +8,11 @@ services:
|
||||
NEXT_PUBLIC_SENTRY_DSN: ${NEXT_PUBLIC_SENTRY_DSN}
|
||||
# SENTRY_AUTH_TOKEN: ${SENTRY_AUTH_TOKEN} # décommenter pour uploader les source maps
|
||||
ports:
|
||||
- "3000:3000"
|
||||
- "4000:4000"
|
||||
env_file: .env
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- konstitisyon_network
|
||||
networks:
|
||||
konstitisyon_network:
|
||||
external: true
|
||||
Reference in New Issue
Block a user