Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
FROM tomcat
WORKDIR webapps
COPY target/WebApp.war .
RUN rm -rf ROOT && mv WebApp.war ROOT.war
ENTRYPOINT ["sh", "/usr/local/tomcat/bin/startup.sh"]
# Use Maven with OpenJDK 8 as the build stage
FROM maven:3.8.6-openjdk-8 AS base

WORKDIR /app

# Copy Maven project files
COPY pom.xml .

# Download dependencies to cache them
RUN mvn dependency:go-offline

# Copy application source code
COPY . .

# Build the WAR file
RUN mvn clean package

# Use Tomcat as the final runtime image
FROM tomcat:latest

WORKDIR /usr/local/tomcat/webapps

# Copy the built WAR file to Tomcat's webapps directory
COPY --from=base /app/target/*.war ./ROOT.war

# Start Tomcat in the foreground
ENTRYPOINT ["catalina.sh", "run"]
5 changes: 5 additions & 0 deletions Dockerfile1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM tomcat:latest
WORKDIR webapps
COPY target/WebApp.war .
RUN rm -rf ROOT && mv WebApp.war ROOT.war
ENTRYPOINT ["sh", "/usr/local/tomcat/bin/startup.sh"]