Fix node version
Some checks failed
Build release Docker image / Build Docker Images (push) Failing after 4m43s

This commit is contained in:
2026-03-05 19:14:48 +01:00
parent ce9d05cd5c
commit 56b913e888

View File

@@ -1,5 +1,5 @@
# --- ÉTAPE 1 : BUILD (On passe en Node 22) --- # --- ÉTAPE 1 : BUILD (Node 20 est le compromis parfait) ---
FROM node:22-alpine AS build-stage FROM node:20-alpine AS build-stage
# Installation des outils pour les modules natifs # Installation des outils pour les modules natifs
RUN apk update && apk add --no-cache \ RUN apk update && apk add --no-cache \
@@ -18,7 +18,7 @@ ENV NODE_ENV=${NODE_ENV}
WORKDIR /opt/ WORKDIR /opt/
COPY package.json yarn.lock ./ COPY package.json yarn.lock ./
# On installe avec Yarn (Node 22 validera les "engines") # On installe avec Yarn. Node 20 satisfait toutes les contraintes d'engines.
RUN yarn install --frozen-lockfile RUN yarn install --frozen-lockfile
WORKDIR /opt/app WORKDIR /opt/app
@@ -27,8 +27,8 @@ COPY . .
# Build de l'admin et du code TS # Build de l'admin et du code TS
RUN yarn build RUN yarn build
# --- ÉTAPE 2 : RUNTIME (Image finale légère) --- # --- ÉTAPE 2 : RUNTIME ---
FROM node:22-alpine AS runtime-stage FROM node:20-alpine AS runtime-stage
RUN apk add --no-cache vips-dev libpng libjpeg-turbo RUN apk add --no-cache vips-dev libpng libjpeg-turbo
ARG NODE_ENV=production ARG NODE_ENV=production
@@ -36,18 +36,15 @@ ENV NODE_ENV=${NODE_ENV}
WORKDIR /opt/app WORKDIR /opt/app
# On récupère les node_modules et le build du stage précédent # On récupère les node_modules et le build
COPY --from=build-stage /opt/node_modules ./node_modules COPY --from=build-stage /opt/node_modules ./node_modules
COPY --from=build-stage /opt/app ./ COPY --from=build-stage /opt/app ./
# Configuration du PATH
ENV PATH=/opt/app/node_modules/.bin:$PATH ENV PATH=/opt/app/node_modules/.bin:$PATH
# Sécurité : on utilise l'utilisateur 'node' au lieu de root
RUN chown -R node:node /opt/app RUN chown -R node:node /opt/app
USER node USER node
EXPOSE 1337 EXPOSE 1337
# Une seule commande CMD à la fin
CMD ["yarn", "start"] CMD ["yarn", "start"]