diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..175f95f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +node_modules +npm-debug.log +Dockerfile +.dockerignore +.git +.gitignore +.env \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9e7af21 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +# frontend/Dockerfile +FROM node:18-alpine AS builder + +WORKDIR /app + +COPY package*.json ./ + +RUN npm install --legacy-peer-deps + +COPY . . +ARG REACT_APP_API_URL="" +ENV REACT_APP_API_URL=${REACT_APP_API_URL} +RUN npm run build + +# nginx pour servir les fichiers statiques +FROM nginx:stable-alpine AS runner + +# Copy build output +COPY --from=builder /app/build /usr/share/nginx/html + +# Optionnel : config nginx simple (si tu veux un fallback pour SPA) +# Crée un fichier nginx.conf local et COPY-le ici si tu veux une config spécifique. +# Exemple basique pour SPA (fallback to index.html) +# COPY nginx-spa.conf /etc/nginx/conf.d/nginx-spa.conf + +# Expose port 80 (Caddy fera reverse proxy) +EXPOSE 80 + +# Utilisateur par défaut (nginx image gère user) +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file