-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (26 loc) · 1.06 KB
/
Dockerfile
File metadata and controls
32 lines (26 loc) · 1.06 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
# Stage 1: Build the WAR file using Maven
FROM maven:3.9-eclipse-temurin-17-alpine AS build
WORKDIR /app
# Copy the pom.xml files first to leverage Docker layer caching
# This ensures that if only source code changes, dependencies are not re-downloaded
COPY chpl/pom.xml .
COPY chpl/chpl-api/pom.xml chpl-api/
COPY chpl/chpl-resources/pom.xml chpl-resources/
COPY chpl/chpl-service/pom.xml chpl-service/
# Copy the rest of the project files
COPY chpl/chpl-api/lombok.config chpl-api/lombok.config
COPY chpl/chpl-api/src chpl-api/src
COPY chpl/chpl-resources/src chpl-resources/src
COPY chpl/chpl-service/lombok.config chpl-service/lombok.config
COPY chpl/chpl-service/src chpl-service/src
RUN mvn clean package -DskipTests
# Stage 2: Deploy to Tomcat
FROM tomcat:11.0.18-jdk17
# Copy the custom server.xml
COPY tomcat-config/* /usr/local/tomcat/conf
# Copy the WAR file from the build stage
COPY --from=build /app/chpl-api/target/chpl-service.war /usr/local/tomcat/webapps/chpl-service.war
# Expose our custom Tomcat port
EXPOSE 8181
# Start Tomcat
CMD ["catalina.sh", "run"]