ci: dockerise le front (build Vite/pnpm -> nginx) + workflow Gitea Actions
- DataSentinel/Dockerfile (node 22 + pnpm + nginx) + nginx.conf (SPA + headers sécurité) - workflow build/push image avec VITE_API_URL=https://datasentinel-api.nfteam.ovh
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# Front Data Sentinel — build Vite (pnpm) puis service statique via nginx.
|
||||
FROM node:22-alpine AS build
|
||||
WORKDIR /app
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN corepack enable && pnpm install --frozen-lockfile
|
||||
COPY . .
|
||||
# URL de l'API injectée au build (Vite inline les import.meta.env.VITE_*).
|
||||
ARG VITE_API_URL
|
||||
ENV VITE_API_URL=$VITE_API_URL
|
||||
RUN pnpm build
|
||||
|
||||
FROM nginx:alpine
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
EXPOSE 80
|
||||
@@ -0,0 +1,14 @@
|
||||
server {
|
||||
listen 80;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# SPA : toutes les routes retombent sur index.html
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
add_header X-Frame-Options "DENY" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||||
}
|
||||
Reference in New Issue
Block a user