chore: add ansible backend docker frontend-prep
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
# =========================================================
|
||||
# Stage 1: Build Frontend
|
||||
# =========================================================
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
COPY frontend-prep/package*.json ./
|
||||
RUN npm ci --only=production
|
||||
|
||||
COPY frontend-prep .
|
||||
RUN npm run build && ls -la dist/
|
||||
|
||||
# =========================================================
|
||||
# Stage 2: Nginx + ModSecurity
|
||||
# =========================================================
|
||||
FROM owasp/modsecurity-crs:nginx-alpine
|
||||
|
||||
USER root
|
||||
|
||||
# Copier le frontend build
|
||||
COPY --from=builder /build/dist /usr/share/nginx/html
|
||||
|
||||
# Configs Nginx / ModSecurity
|
||||
COPY docker/frontend/nginx.conf.prod /etc/nginx/conf.d/app.conf
|
||||
COPY docker/frontend/main.conf /etc/nginx/modsec/main.conf
|
||||
COPY docker/frontend/ban-on-crs-scores-delivery-api.conf /etc/nginx/modsec/ban-on-crs-scores-delivery-api.conf
|
||||
COPY docker/frontend/crs-setup.conf /etc/nginx/modsec/crs-setup.conf
|
||||
|
||||
# Supprimer template par défaut
|
||||
RUN rm -f /etc/nginx/templates/conf.d/default.conf.template || true
|
||||
|
||||
# Variables ModSecurity
|
||||
ENV MODSEC_ENGINE=On \
|
||||
PARANOIA=2 \
|
||||
ANOMALY_INBOUND=5 \
|
||||
ANOMALY_OUTBOUND=4
|
||||
|
||||
# Permissions
|
||||
RUN chown -R nginx:nginx /usr/share/nginx/html \
|
||||
&& mkdir -p /etc/letsencrypt \
|
||||
&& chown -R nginx:nginx /etc/letsencrypt
|
||||
|
||||
USER nginx
|
||||
|
||||
EXPOSE 80 443
|
||||
|
||||
STOPSIGNAL SIGQUIT
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Reference in New Issue
Block a user