92 lines
2.8 KiB
Docker
92 lines
2.8 KiB
Docker
####
|
|
# 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"]
|
|
|