EdulabFrontend / Dockerfile
rinogeek's picture
Initial commit: EduLab Frontend for Hugging Face Spaces
aa6ef1d
raw
history blame contribute delete
890 Bytes
# Build stage
FROM node:20-slim AS build
WORKDIR /app
# Copier les fichiers de package
COPY package*.json ./
# Installer les dépendances
RUN npm install
# Copier le reste des fichiers du projet
COPY . .
# Argument pour l'URL de l'API (passé lors du build ou défini ici par défaut)
ARG VITE_API_URL=https://rinogeek-edulabbackend.hf.space/api/
ENV VITE_API_URL=$VITE_API_URL
# Copier le fichier .env.production comme .env pour la production
RUN cp .env.production .env || true
# Builder l'application
RUN npm run build
# Serve stage
FROM nginx:alpine
# Copier les fichiers buildés vers nginx
COPY --from=build /app/dist /usr/share/nginx/html
# Copier une configuration nginx personnalisée pour gérer le routing SPA
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Exposer le port 7860 (Hugging Face Spaces)
EXPOSE 7860
# Démarrer Nginx
CMD ["nginx", "-g", "daemon off;"]