-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (21 loc) · 839 Bytes
/
Dockerfile
File metadata and controls
29 lines (21 loc) · 839 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
# Stage 1: Build the artifact using Maven
FROM maven:3.9.6-eclipse-temurin-17 AS build_stage
LABEL author="vprofile-project"
# Set the working directory
WORKDIR /app
# Copy the source code to the container
COPY . .
# Build the WAR file and skip tests for speed
RUN mvn clean install -DskipTests
# Stage 2: Deploy the artifact to Tomcat 10
# We use Tomcat 10.1 to support Jakarta EE (Servlet 5.0+)
FROM tomcat:10.1-jdk17-openjdk-slim
# Remove default Tomcat applications to keep the image clean
RUN rm -rf /usr/local/tomcat/webapps/*
# Copy the generated WAR file from the build stage
# Note: Ensure the path to your .war file matches your project structure
COPY --from=build_stage /app/target/vprofile-v2.war /usr/local/tomcat/webapps/ROOT.war
# Expose the default Tomcat port
EXPOSE 8080
# Start Tomcat
CMD ["catalina.sh", "run"]