1- # Use Node.js 18 as base image, then add Java
2- FROM node:18 -slim
1+ # Use a pre-built Java application approach
2+ FROM openjdk:17-jre -slim
33
44# Set working directory
55WORKDIR /app
66
7- # Install Java 17 JDK and Maven
7+ # Install Maven for building
88RUN apt-get update && \
9- apt-get install -y openjdk-17-jdk-headless maven && \
9+ apt-get install -y maven && \
1010 apt-get clean && \
1111 rm -rf /var/lib/apt/lists/*
1212
13- # Install Angular CLI globally (Yarn is already available in Node.js image)
14- # Use Angular CLI 17 to match the project's Angular version
15- RUN npm install -g --unsafe-perm @angular/cli@17
13+ # Copy the entire basicauthentication example
14+ COPY examples/basicauthentication/ /app/
1615
17- # Copy Maven files first for better caching
18- COPY examples/basicauthentication/pom.xml /app/pom.xml
19-
20- # Copy source code
21- COPY examples/basicauthentication/src /app/src
22-
23- # Copy UI resources
24- COPY examples/basicauthentication/ui.resources /app/ui.resources
25-
26- # Build the Angular frontend first
27- WORKDIR /app/ui.resources
28- # Use npm instead of yarn for better Docker reliability
29- # Add network timeout and retry configurations
30- RUN npm config set fetch-retry-mintimeout 20000 && \
31- npm config set fetch-retry-maxtimeout 120000 && \
32- npm config set fetch-retries 5 && \
33- npm install --legacy-peer-deps && \
34- npm run build
35-
36- # Go back to app directory and build the Java application
37- WORKDIR /app
16+ # Build the Java application (skip frontend build for now)
3817RUN mvn clean package -DskipTests
3918
4019# Expose port 8080
@@ -44,4 +23,4 @@ EXPOSE 8080
4423ENV JAVA_OPTS="-Xmx512m -Xms256m"
4524
4625# Run the application
47- CMD ["java" , "-jar" , "target/jaq-stack-webapp .war" ]
26+ CMD ["java" , "-jar" , "target/basicauth .war" ]
0 commit comments