Initial commit
This commit is contained in:
55
Dockerfile.prod
Normal file
55
Dockerfile.prod
Normal file
@@ -0,0 +1,55 @@
|
||||
# Multi-stage build pour BTP Xpress Server avec Keycloak
|
||||
FROM maven:3.9.6-eclipse-temurin-17 AS builder
|
||||
|
||||
# Copier les fichiers de configuration Maven
|
||||
COPY pom.xml /app/
|
||||
WORKDIR /app
|
||||
|
||||
# Télécharger les dépendances (cache Docker)
|
||||
RUN mvn dependency:go-offline -B
|
||||
|
||||
# Copier le code source
|
||||
COPY src /app/src
|
||||
|
||||
# Construire l'application
|
||||
RUN mvn clean package -DskipTests -B
|
||||
|
||||
# Image de production optimisée
|
||||
FROM registry.access.redhat.com/ubi8/openjdk-17:1.18
|
||||
|
||||
ENV LANGUAGE='en_US:en'
|
||||
|
||||
# Configuration des variables d'environnement pour production
|
||||
ENV DB_URL=jdbc:postgresql://postgres:5432/btpxpress
|
||||
ENV DB_USERNAME=btpxpress_user
|
||||
ENV DB_PASSWORD=changeme
|
||||
ENV SERVER_PORT=8080
|
||||
ENV KEYCLOAK_SERVER_URL=https://security.lions.dev
|
||||
ENV KEYCLOAK_REALM=btpxpress
|
||||
ENV KEYCLOAK_CLIENT_ID=btpxpress-backend
|
||||
ENV KEYCLOAK_CLIENT_SECRET=changeme
|
||||
|
||||
# Installer curl pour les health checks
|
||||
USER root
|
||||
RUN microdnf install curl -y && microdnf clean all
|
||||
RUN mkdir -p /app/logs && chown -R 185:185 /app/logs
|
||||
USER 185
|
||||
|
||||
# Copier l'application depuis le builder
|
||||
COPY --from=builder --chown=185 /app/target/quarkus-app/lib/ /deployments/lib/
|
||||
COPY --from=builder --chown=185 /app/target/quarkus-app/*.jar /deployments/
|
||||
COPY --from=builder --chown=185 /app/target/quarkus-app/app/ /deployments/app/
|
||||
COPY --from=builder --chown=185 /app/target/quarkus-app/quarkus/ /deployments/quarkus/
|
||||
|
||||
# Exposer le port
|
||||
EXPOSE 8080
|
||||
|
||||
# Variables d'environnement optimisées pour la production
|
||||
ENV JAVA_OPTS="-Xmx1g -Xms512m -XX:+UseG1GC -XX:+UseStringDeduplication"
|
||||
|
||||
# Point d'entrée avec profil production
|
||||
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -Dquarkus.profile=prod -jar /deployments/quarkus-run.jar"]
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
||||
CMD curl -f http://localhost:8080/btpxpress/q/health/ready || exit 1
|
||||
Reference in New Issue
Block a user