BaseAnalyzer/Dockerfile
2025-10-10 15:36:11 +02:00

29 lines
No EOL
823 B
Docker

# Stage 1: Build the application using SBT
FROM hseeberger/sbt:8u222-2.11.12-0.13.18 as builder
WORKDIR /app
# Copy project definition files and resolve dependencies first for better layer caching
COPY project/ ./project/
COPY build.sbt .
# This step will download all the dependencies
RUN sbt update
# Copy the rest of the source code
COPY . .
# Package the application into a WAR file
RUN sbt package
# Stage 2: Create the runtime image with Tomcat
FROM tomcat:9.0-jdk11-openjdk-slim
# Remove the default webapps
RUN rm -rf /usr/local/tomcat/webapps/*
# Copy the WAR file from the builder stage to Tomcat's webapps directory
# The WAR file will be automatically deployed by Tomcat on startup
COPY --from=builder /app/target/scala-2.11/coc-base-analyser_2.11-0.1.war /usr/local/tomcat/webapps/ROOT.war
EXPOSE 8080