From 6174a0d49fb52cee5dfdce4f358617f7f3b368b2 Mon Sep 17 00:00:00 2001 From: Lucas Li <35748253+yzlucas@users.noreply.github.com> Date: Fri, 18 Oct 2024 10:06:12 -0700 Subject: [PATCH] UI docker fix01 (#218) * remove dist/wfprev in basehref * adding pub/wfprev path bck * adding pub/wfprev path bck --- .github/workflows/mvn-build.yml | 2 +- client/wfprev-war/Dockerfile | 1 + client/wfprev-war/backend/server.js | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/mvn-build.yml b/.github/workflows/mvn-build.yml index 8623ecf0..58d328eb 100644 --- a/.github/workflows/mvn-build.yml +++ b/.github/workflows/mvn-build.yml @@ -76,7 +76,7 @@ jobs: if: ${{ inputs.COMPONENT_TYPE == 'client' }} run: | cd ${{ inputs.COMPONENT_TYPE }}/wfprev-war/src/main/angular - npm run build -- --configuration=production + npm run build -- --configuration=production --base-href=/pub/wfprev/ - name: Copy client built files to necessary folder if: ${{ inputs.COMPONENT_TYPE == 'client' }} diff --git a/client/wfprev-war/Dockerfile b/client/wfprev-war/Dockerfile index 16c55c32..9523ae9e 100644 --- a/client/wfprev-war/Dockerfile +++ b/client/wfprev-war/Dockerfile @@ -9,6 +9,7 @@ RUN echo "Root directory contents before copy:" && ls -la / # Copy the pre-built Angular app from the local machine into the container COPY ./dist/wfprev ./dist/wfprev +# COPY src/main/angular/dist/wfprev ./dist/wfprev # Log the contents of the /app directory after copying RUN echo "App directory contents after copy:" && ls -la /app diff --git a/client/wfprev-war/backend/server.js b/client/wfprev-war/backend/server.js index 3d53bd8c..f3573cb0 100644 --- a/client/wfprev-war/backend/server.js +++ b/client/wfprev-war/backend/server.js @@ -15,10 +15,10 @@ app.use(cors()); app.use(bodyParser.json()); // Serve static files from the Angular app -app.use(express.static(path.join(__dirname, 'dist/wfprev'))); +app.use('/pub/wfprev', express.static(path.join(__dirname, 'dist/wfprev'))); // Send all requests to Angular app -app.get('/*', (req, res) => { +app.get('/pub/wfprev/*', (req, res) => { res.sendFile(path.join(__dirname, 'dist/wfprev/index.html')); });