added 'yarn postbuild' script for fixing env.js in dist/index.html
ref #31
This commit is contained in:
parent
ad13bae068
commit
51d058bf96
|
@ -3,6 +3,7 @@ WORKDIR /app
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN yarn
|
RUN yarn
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
RUN yarn postbuild
|
||||||
# final image
|
# final image
|
||||||
FROM fholzer/nginx-brotli:v1.19.1
|
FROM fholzer/nginx-brotli:v1.19.1
|
||||||
COPY --from=0 /app/dist /usr/share/nginx/html
|
COPY --from=0 /app/dist /usr/share/nginx/html
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
const fs = require('fs');
|
||||||
|
if (fs.existsSync('./dist/index.html')) {
|
||||||
|
const content = fs.readFileSync('./dist/index.html', { encoding: 'utf8' });
|
||||||
|
const newcontent = content.replace(`"/env.js"`, `"./env.js"`);
|
||||||
|
fs.writeFileSync('./dist/index.html', newcontent);
|
||||||
|
}
|
|
@ -4,7 +4,8 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"release": "release-it --only-version"
|
"release": "release-it --only-version",
|
||||||
|
"postbuild": "node env_fix.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"marked": "2.0.3",
|
"marked": "2.0.3",
|
||||||
|
|
Loading…
Reference in New Issue