From b68ba173a3e3a4fb1a57a88dac53457090b0777c Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 3 May 2026 14:18:02 +0700 Subject: [PATCH] 690503:1418 Update workflow #07 --- frontend/Dockerfile | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 9284713..73b22da 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -25,8 +25,8 @@ WORKDIR /w COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ COPY frontend/package.json ./frontend/ -# Install frontend deps only -RUN pnpm install --frozen-lockfile --filter lcbp3-frontend... +# Install frontend deps only (--ignore-scripts เพื่อข้าม postinstall ที่อาจ fail ใน CI) +RUN pnpm install --frozen-lockfile --ignore-scripts --filter lcbp3-frontend... # ========================= # Stage 2: Build Application @@ -48,6 +48,24 @@ COPY frontend/ ./ # Ensure public directory exists and has content RUN ls -la /w/frontend/public/ || (echo "WARNING: public directory not found, creating empty one" && mkdir -p /w/frontend/public) +# Copy Monaco Editor assets สำหรับ self-hosting (ไม่ต้องพึ่ง cdn.jsdelivr.net) +# เพื่อผ่าน CSP directive: style-src 'self' 'unsafe-inline' +RUN node -e "\ + const fs=require('fs'); \ + const path=require('path'); \ + const dst='/w/frontend/public/monaco-vs'; \ + const searchPaths=['/w/frontend/node_modules','/w/node_modules']; \ + try { \ + const pkgJson=require.resolve('monaco-editor/package.json',{paths:searchPaths}); \ + const src=path.join(path.dirname(pkgJson),'min','vs'); \ + if(!fs.existsSync(dst)){fs.cpSync(src,dst,{recursive:true});console.log('Monaco assets copied from: '+src)} \ + else{console.log('Monaco assets already exist at '+dst)} \ + } catch(e) { \ + console.error('ERROR: monaco-editor not found in',searchPaths,e.message); \ + process.exit(1); \ + } \ +" + # NEXT_PUBLIC_* vars must be set at BUILD TIME (baked into client bundle) ARG NEXT_PUBLIC_API_URL=https://backend.np-dms.work/api ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}