feat: Add production Dockerfiles and Keycloak realm configuration

- Add Dockerfile.prod for unionflow-server (backend) with production settings
- Add Dockerfile.prod for unionflow-client (frontend) with production settings
- Add unionflow-realm-production.json with SUPER_ADMIN role and unionflow-client
- Configure for deployment on https://unionflow.lions.dev

Database: unionflow on postgresql.postgresql.svc.cluster.local
Keycloak: https://security.lions.dev/realms/unionflow
Backend: Port 8085, https://api.lions.dev/unionflow
Frontend: Port 8086, https://unionflow.lions.dev
This commit is contained in:
dahoud
2025-12-07 14:46:11 +00:00
parent 35ddcb1d2d
commit 00d3906fd2
3 changed files with 367 additions and 0 deletions

View File

@@ -0,0 +1,91 @@
####
# Dockerfile de production pour UnionFlow Client (Frontend)
# Multi-stage build optimisé avec sécurité renforcée
####
## Stage 1 : Build avec Maven
FROM maven:3.9.6-eclipse-temurin-17 AS builder
WORKDIR /app
# Copier les fichiers de configuration Maven
COPY pom.xml .
COPY ../unionflow-server-api/pom.xml ../unionflow-server-api/
# Télécharger les dépendances (cache Docker)
RUN mvn dependency:go-offline -B -pl unionflow-client-quarkus-primefaces-freya -am
# Copier le code source
COPY src ./src
# Build de l'application avec profil production
RUN mvn clean package -DskipTests -B -Dquarkus.profile=prod -pl unionflow-client-quarkus-primefaces-freya
## Stage 2 : Image de production optimisée et sécurisée
FROM registry.access.redhat.com/ubi8/openjdk-17:1.18
ENV LANGUAGE='fr_FR:fr'
# Variables d'environnement de production
ENV QUARKUS_PROFILE=prod
ENV QUARKUS_HTTP_PORT=8086
ENV QUARKUS_HTTP_HOST=0.0.0.0
# Configuration Keycloak/OIDC (production)
ENV QUARKUS_OIDC_AUTH_SERVER_URL=https://security.lions.dev/realms/unionflow
ENV QUARKUS_OIDC_CLIENT_ID=unionflow-client
ENV QUARKUS_OIDC_ENABLED=true
ENV QUARKUS_OIDC_TLS_VERIFICATION=required
ENV KEYCLOAK_CLIENT_SECRET=changeme
# Configuration API Backend
ENV UNIONFLOW_BACKEND_URL=https://api.lions.dev/unionflow
# Configuration CORS
ENV QUARKUS_HTTP_CORS_ORIGINS=https://unionflow.lions.dev,https://security.lions.dev
ENV QUARKUS_HTTP_CORS_ALLOW_CREDENTIALS=true
# Configuration Session
ENV SESSION_TIMEOUT=1800
ENV REMEMBER_ME_DURATION=604800
# Installer curl pour les health checks
USER root
RUN microdnf install -y curl && \
microdnf clean all && \
rm -rf /var/cache/yum
# Créer les répertoires et permissions pour utilisateur non-root
RUN mkdir -p /deployments /app/logs && \
chown -R 185:185 /deployments /app/logs
# Passer à l'utilisateur non-root pour la sécurité
USER 185
# Copier l'application depuis le builder (format fast-jar Quarkus)
COPY --from=builder --chown=185 /app/target/quarkus-app/ /deployments/
# Exposer le port
EXPOSE 8086
# Variables JVM optimisées pour production avec sécurité
ENV JAVA_OPTS="-Xmx768m -Xms256m \
-XX:+UseG1GC \
-XX:MaxGCPauseMillis=200 \
-XX:+UseStringDeduplication \
-XX:+ParallelRefProcEnabled \
-XX:+HeapDumpOnOutOfMemoryError \
-XX:HeapDumpPath=/app/logs/heapdump.hprof \
-Djava.security.egd=file:/dev/./urandom \
-Djava.awt.headless=true \
-Dfile.encoding=UTF-8 \
-Djava.util.logging.manager=org.jboss.logmanager.LogManager \
-Dquarkus.profile=${QUARKUS_PROFILE}"
# Health check avec endpoints Quarkus
HEALTHCHECK --interval=30s --timeout=10s --start-period=90s --retries=3 \
CMD curl -f http://localhost:8086/q/health/ready || exit 1
# Point d'entrée avec profil production (format fast-jar)
ENTRYPOINT ["sh", "-c", "exec java $JAVA_OPTS -jar /deployments/quarkus-run.jar"]