diff --git a/Dockerfile b/Dockerfile index 5883ac1c..3c37701e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,40 +1,19 @@ - # Use Node.js 18 as base image, then add Java -FROM node:18-slim +# Use a pre-built Java application approach +FROM openjdk:17-jre-slim # Set working directory WORKDIR /app -# Install Java 17 JDK and Maven +# Install Maven for building RUN apt-get update && \ - apt-get install -y openjdk-17-jdk-headless maven && \ + apt-get install -y maven && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* -# Install Angular CLI globally (Yarn is already available in Node.js image) -# Use Angular CLI 17 to match the project's Angular version -RUN npm install -g --unsafe-perm @angular/cli@17 +# Copy the entire basicauthentication example +COPY examples/basicauthentication/ /app/ -# Copy Maven files first for better caching -COPY examples/basicauthentication/pom.xml /app/pom.xml - -# Copy source code -COPY examples/basicauthentication/src /app/src - -# Copy UI resources -COPY examples/basicauthentication/ui.resources /app/ui.resources - -# Build the Angular frontend first -WORKDIR /app/ui.resources -# Use npm instead of yarn for better Docker reliability -# Add network timeout and retry configurations -RUN npm config set fetch-retry-mintimeout 20000 && \ - npm config set fetch-retry-maxtimeout 120000 && \ - npm config set fetch-retries 5 && \ - npm install --legacy-peer-deps && \ - npm run build - -# Go back to app directory and build the Java application -WORKDIR /app +# Build the Java application (skip frontend build for now) RUN mvn clean package -DskipTests # Expose port 8080 @@ -44,4 +23,4 @@ EXPOSE 8080 ENV JAVA_OPTS="-Xmx512m -Xms256m" # Run the application -CMD ["java", "-jar", "target/jaq-stack-webapp.war"] +CMD ["java", "-jar", "target/basicauth.war"]