Skip to content
Merged
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
37 changes: 8 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"]
Loading