-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (25 loc) · 973 Bytes
/
Copy pathDockerfile
File metadata and controls
36 lines (25 loc) · 973 Bytes
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
# Stage 1: Build the JAR using Maven
FROM maven:3.9.6-eclipse-temurin-17 AS builder
LABEL org.opencontainers.image.description="Birthday Calendar Service creates and synchronizes a birthday calendar from CardDAV address book data."
WORKDIR /build
# Copy pom.xml and download dependencies first (for Docker cache)
COPY pom.xml .
RUN mvn dependency:go-offline
# Copy the full source tree and build the application
COPY src ./src
RUN mvn clean package -DskipTests
# Stage 2: Minimal runtime image
FROM eclipse-temurin:17-jdk-jammy
WORKDIR /app
# Optional: add tini to manage signals properly
RUN apt-get update && apt-get install -y tini && rm -rf /var/lib/apt/lists/*
# Create a non-root user
RUN useradd -m bcsuser
USER bcsuser
# Copy the built jar from the builder stage
COPY --from=builder /build/target/*.jar /app/bcs.jar
# Optionally copy default config
# COPY bcs.yml .
# COPY logback.xml .
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["java", "-jar", "bcs.jar"]