-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.admin
More file actions
54 lines (40 loc) · 1.5 KB
/
Dockerfile.admin
File metadata and controls
54 lines (40 loc) · 1.5 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
44
45
46
47
48
49
50
51
52
53
54
# Multi-stage build for bottin-admin-ui
FROM eclipse-temurin:21-jdk-alpine AS builder
WORKDIR /app
# Copy Maven files first for better caching
COPY pom.xml .
COPY bottin-core/pom.xml bottin-core/
COPY bottin-persistence/pom.xml bottin-persistence/
COPY bottin-service/pom.xml bottin-service/
COPY bottin-verification/pom.xml bottin-verification/
COPY bottin-web/pom.xml bottin-web/
COPY bottin-admin-ui/pom.xml bottin-admin-ui/
COPY bottin-spring-boot-starter/pom.xml bottin-spring-boot-starter/
COPY bottin-tests/pom.xml bottin-tests/
COPY bottin-tests/bottin-it/pom.xml bottin-tests/bottin-it/
# Download dependencies (cached if pom.xml hasn't changed)
RUN apk add --no-cache maven && \
mvn dependency:go-offline -B || true
# Copy source code
COPY . .
# Build the application
RUN mvn package -DskipTests -B -pl bottin-admin-ui -am
# Runtime image
FROM eclipse-temurin:21-jre-alpine
WORKDIR /app
# Create non-root user
RUN addgroup -g 1000 bottin && \
adduser -u 1000 -G bottin -s /bin/sh -D bottin
# Copy the built JAR (use the exec jar which is the repackaged Spring Boot jar)
COPY --from=builder /app/bottin-admin-ui/target/bottin-admin-ui-*-exec.jar app.jar
# Set ownership
RUN chown -R bottin:bottin /app
USER bottin
# Expose port
EXPOSE 8081
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=60s --retries=3 \
CMD wget -q --spider http://localhost:8081/actuator/health || exit 1
# Run the application
ENTRYPOINT ["java", "-jar", "app.jar"]
CMD ["--spring.profiles.active=prod"]