Files
2026-05-06 14:57:03 -04:00

43 lines
1.3 KiB
Docker

# 1. Stage: Extract tomcat files from the official image
FROM tomcat:8.0-jre8 AS tomcat-stage
# 2. Stage: Build your application using Temurin JDK
FROM eclipse-temurin:8-jdk AS builder
# Install Apache Ant in your Temurin builder
RUN apt-get update && apt-get install -y ant && rm -rf /var/lib/apt/lists/*
# Copy the Tomcat libs from the tomcat-stage to a directory in your builder
COPY --from=tomcat-stage /usr/local/tomcat/lib /opt/tomcat/lib
# Set your working directory and run Ant build
WORKDIR /app
COPY . .
# RUN ant -f ./compile-jasper.xml
# RUN ant -f trunk/nbproject/compile-jasper.xml
RUN ant war
# RUN ant war
# RUN ant clean war
# STAGE 2: Deploy to Tomcat
FROM tomcat-stage
WORKDIR /usr/local/tomcat
ENV JASPER_VERSION=6.1.1
# ENV CATALINA_HOME /usr/local/tomcat
# Remove default Tomcat apps to avoid conflicts
RUN rm -rf ./webapps/*
# COPY /trunk/servlet-api.jar /usr/local/tomcat/lib/servlet-api.jar
# Copy the generated WAR from the builder stage
# COPY --from=builder /app/dist/BrittonReportServer.war /app/dist/BrittonReportServer.war
COPY --from=builder /app/dist/BrittonReportServer.war ./webapps/ROOT.war
RUN mkdir -p /app/compiled_war
COPY --from=builder /app/dist/BrittonReportServer.war /app/compiled_war/
EXPOSE 8080
CMD ["catalina.sh", "run"]