-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (31 loc) · 1.05 KB
/
Copy pathDockerfile
File metadata and controls
43 lines (31 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Stage 1: Build
FROM gradle:8.8-jdk21 AS build
WORKDIR /app
# Copy gradle files first for better caching
COPY build.gradle settings.gradle gradle.properties ./
COPY gradle ./gradle
# Download dependencies
RUN gradle dependencies --no-daemon
# Copy source code
COPY src ./src
# Build the application
RUN gradle build -Dquarkus.package.jar.type=uber-jar --no-daemon
# Stage 2: Runtime
FROM eclipse-temurin:21-jre-alpine
WORKDIR /app
# Install necessary packages
RUN apk add --no-cache curl
# Create non-root user
RUN addgroup -g 1001 quarkus && \
adduser -u 1001 -G quarkus -D quarkus
# Copy the uber-jar from build stage
COPY --from=build --chown=quarkus:quarkus /app/build/whatsapp-calculator-service-*-runner.jar app.jar
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8080/q/health || exit 1
# Switch to non-root user
USER quarkus
# Expose port
EXPOSE 8080
# Run the application
ENTRYPOINT ["java", "-Djava.util.logging.manager=org.jboss.logmanager.LogManager", "-jar", "app.jar"]