fix(docker): rewrite for fast-jar layout (target/quarkus-app/) + Java 21 + UID 1001 (lionsctl pipeline compat)
Some checks failed
CI/CD Pipeline / pipeline (push) Failing after 4m37s
Some checks failed
CI/CD Pipeline / pipeline (push) Failing after 4m37s
This commit is contained in:
48
Dockerfile
48
Dockerfile
@@ -1,45 +1,21 @@
|
||||
####
|
||||
# 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
|
||||
# Dockerfile for btpxpress-server
|
||||
# Used by lionsctl pipeline. Expects `mvn clean package -Pprod` to have produced target/quarkus-app/ (fast-jar).
|
||||
FROM registry.access.redhat.com/ubi8/openjdk-21:1.21
|
||||
|
||||
ENV LANGUAGE='en_US:en'
|
||||
|
||||
# Install curl for health checks
|
||||
RUN apk add --no-cache curl
|
||||
COPY --chown=1001:1001 target/quarkus-app/lib/ /deployments/lib/
|
||||
COPY --chown=1001:1001 target/quarkus-app/*.jar /deployments/
|
||||
COPY --chown=1001:1001 target/quarkus-app/app/ /deployments/app/
|
||||
COPY --chown=1001:1001 target/quarkus-app/quarkus/ /deployments/quarkus/
|
||||
|
||||
# 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
|
||||
USER 1001
|
||||
|
||||
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"
|
||||
ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
||||
CMD curl -f http://localhost:8080/q/health/ready || exit 1
|
||||
|
||||
ENTRYPOINT [ "java", "-jar", "/deployments/app.jar" ]
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=30s --retries=3 \
|
||||
CMD curl -f http://localhost:8080/q/health/live || exit 1
|
||||
|
||||
ENTRYPOINT [ "java", "-jar", "/deployments/quarkus-run.jar" ]
|
||||
|
||||
Reference in New Issue
Block a user