diff --git a/.dockerignore b/.dockerignore index c5f2cc95..b0c745e9 100644 --- a/.dockerignore +++ b/.dockerignore @@ -24,6 +24,8 @@ node_modules/ npm-debug.log* yarn-debug.log* yarn-error.log* +package-lock.json +yarn.lock # Build artifacts target/ diff --git a/Dockerfile b/Dockerfile index 0ccc58a0..274743fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -# Use Node.js 18 as base image, then add Java + # Use Node.js 18 as base image, then add Java FROM node:18-slim # Set working directory @@ -25,7 +25,13 @@ COPY examples/basicauthentication/ui.resources /app/ui.resources # Build the Angular frontend first WORKDIR /app/ui.resources -RUN yarn install && yarn build +# 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 && \ + npm run build # Go back to app directory and build the Java application WORKDIR /app diff --git a/examples/basicauthentication/pom.xml b/examples/basicauthentication/pom.xml index e1dd5262..5ddaa0aa 100644 --- a/examples/basicauthentication/pom.xml +++ b/examples/basicauthentication/pom.xml @@ -193,10 +193,10 @@ - exec-yarn-install + exec-npm-install generate-sources - yarn + npm install @@ -209,8 +209,9 @@ exec-ngcli-build generate-sources - ng + npx + ng build --base-href=#context-path#