Files
btpxpress-backend/Dockerfile
dahoud 3bd7f74a77 Fix: Correct Dockerfile HEALTHCHECK and Swagger UI URL for root-path configuration
- Fixed HEALTHCHECK to use /btpxpress/q/health/ready instead of /q/health/ready
- Added quarkus.swagger-ui.urls.default=/btpxpress/openapi for correct OpenAPI loading
- Ensures Swagger UI loads the spec from the correct path with root-path

These fixes ensure:
1. Docker health checks work correctly with quarkus.http.root-path=/btpxpress
2. Swagger UI correctly loads /btpxpress/openapi instead of /openapi
3. Pods are marked healthy by Kubernetes

Resolves the 404 error in Swagger UI when loading API definition.
2025-10-23 15:26:11 +00:00

46 lines
1.3 KiB
Docker

####
# This Dockerfile is used to build a production-ready Quarkus application
####
## Stage 1 : Build with Maven
FROM maven:3.9.6-eclipse-temurin-17 AS build
WORKDIR /build
# Copy pom.xml and download dependencies
COPY pom.xml .
RUN mvn dependency:go-offline -B
# Copy source code
COPY src ./src
# Build application with optimizations
RUN mvn clean package -DskipTests -Dquarkus.package.type=uber-jar
## Stage 2 : Create runtime image
FROM eclipse-temurin:17-jre-alpine
ENV LANGUAGE='en_US:en'
# Install curl for health checks
RUN apk add --no-cache curl
# Create app user and directories
RUN addgroup -g 185 -S appuser && adduser -u 185 -S appuser -G appuser
RUN mkdir -p /deployments && chown -R appuser:appuser /deployments
# Copy the uber-jar (single JAR with all dependencies)
COPY --from=build --chown=appuser:appuser /build/target/*-runner.jar /deployments/app.jar
EXPOSE 8080
USER appuser
# Optimized JVM settings for production
ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -XX:+UseG1GC -XX:MaxRAMPercentage=75.0 -XX:+UseStringDeduplication"
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:8080/btpxpress/q/health/ready || exit 1
ENTRYPOINT [ "java", "-jar", "/deployments/app.jar" ]