Corrections pour assurer la cohérence avec les autres projets en production : ## Changements ### DB_HOST: postgres → postgresql - kubernetes/afterwork-configmap.yaml - src/main/resources/application-prod.properties (défaut) - Dockerfile.prod (ENV) ### DB_PASSWORD: Pattern cohérent - kubernetes/afterwork-secrets.yaml - Nouveau mot de passe: AfterWork2025! - Suit le pattern observé dans unionflow (UnionFlow2025!) et btpxpress ## Analyse des Projets Existants ### BTPXpress - Host: postgresql - User: btpxpress - Password: btpxpress_secure_2024 ### UnionFlow - Host: postgresql (implicite) - User: unionflow - Password: UnionFlow2025! ### AfterWork (Corrigé) - Host: postgresql ✅ - User: afterwork ✅ - Password: AfterWork2025! ✅ ## Documentation - DATABASE_CONFIG.md : Guide complet de configuration DB - Paramètres de connexion - Commandes de vérification - Troubleshooting - Checklist de déploiement ## Impact ✅ Configuration cohérente avec les autres projets ✅ Évite les erreurs de connexion au déploiement ✅ Pattern de sécurité uniforme ✅ Documentation complète pour maintenance
62 lines
1.8 KiB
Docker
62 lines
1.8 KiB
Docker
##
|
|
## AfterWork Server - Production Dockerfile
|
|
## Build stage avec Maven + Runtime optimisé avec UBI8 OpenJDK 17
|
|
##
|
|
|
|
# ======================================
|
|
# STAGE 1: Build de l'application
|
|
# ======================================
|
|
FROM registry.access.redhat.com/ubi8/openjdk-17:1.18 AS builder
|
|
|
|
USER root
|
|
|
|
# Installation de Maven
|
|
RUN microdnf install -y maven && microdnf clean all
|
|
|
|
# Copie des fichiers du projet
|
|
WORKDIR /build
|
|
COPY pom.xml .
|
|
COPY src ./src
|
|
|
|
# Build de l'application (skip tests pour accélérer)
|
|
RUN mvn clean package -DskipTests -Dquarkus.package.type=uber-jar
|
|
|
|
# ======================================
|
|
# STAGE 2: Image de runtime
|
|
# ======================================
|
|
FROM registry.access.redhat.com/ubi8/openjdk-17-runtime:1.18
|
|
|
|
# Variables d'environnement par défaut
|
|
ENV LANG='en_US.UTF-8' \
|
|
LANGUAGE='en_US:en' \
|
|
TZ='Africa/Douala' \
|
|
QUARKUS_PROFILE=prod \
|
|
DB_HOST=postgresql \
|
|
DB_PORT=5432 \
|
|
DB_NAME=afterwork_db \
|
|
DB_USERNAME=afterwork \
|
|
DB_PASSWORD=changeme \
|
|
JAVA_OPTS_APPEND="-XX:+UseG1GC \
|
|
-XX:+StringDeduplication \
|
|
-XX:+OptimizeStringConcat \
|
|
-XX:MaxRAMPercentage=75.0 \
|
|
-XX:+HeapDumpOnOutOfMemoryError \
|
|
-XX:HeapDumpPath=/tmp/heapdump.hprof \
|
|
-Djava.net.preferIPv4Stack=true"
|
|
|
|
# Configuration du port
|
|
EXPOSE 8080
|
|
|
|
# Copie de l'uber-jar depuis le builder
|
|
COPY --from=builder --chown=185:185 /build/target/*-runner.jar /deployments/app.jar
|
|
|
|
# User non-root pour la sécurité
|
|
USER 185
|
|
|
|
# Healthcheck sur l'endpoint Quarkus
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
|
CMD curl -f http://localhost:8080/q/health/ready || exit 1
|
|
|
|
# Lancement de l'application
|
|
ENTRYPOINT ["java", "-jar", "/deployments/app.jar"]
|