Skip to content

Commit

Permalink
Merge pull request #196 from terwer/v4.x
Browse files Browse the repository at this point in the history
feat:Fix docker build
  • Loading branch information
terwer authored Aug 28, 2022
2 parents 28a777f + 06cebe3 commit 1f35191
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
1 change: 1 addition & 0 deletions jvue-front/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,4 @@ yarn.lock
node_modules
node_modules_dev/
node_modules_prod/
node_modules/.yargit n-integrity
31 changes: 22 additions & 9 deletions jvue-front/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
#依赖的镜像
FROM node:10.15.3-alpine
FROM node:16.17-alpine

# 工作目录
WORKDIR /app

# 安装依赖
COPY ./jvue-front/package.json ./

# yarn 已经有了,没必要重复安装
# 因为被墙,单独安装
ENV SASS_BINARY_SITE https://npm.taobao.org/mirrors/node-sass
# ENV SASS_BINARY_SITE https://cdn.npmmirror.com/binaries/node-sass
# CDN注册以及安装依赖库
RUN npm config set registry https://registry.npm.taobao.org && \
npm set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver && \
npm cache clean --force && \
npm install --save-dev node-sass sass-loader && \
npm install
# RUN npm config set registry https://registry.npmmirror.com/ && \
# npm i -g yarn

RUN yarn config set registry https://registry.npmmirror.com/ --global && \
yarn config set disturl https://npmmirror.com/package/dist --global && \
yarn config set sass_binary_site https://cdn.npmmirror.com/binaries/node-sass --global && \
yarn config set electron_mirror https://registry.npmmirror.com/binary.html?path=electron/ --global && \
yarn config set puppeteer_download_host https://registry.npmmirror.com/binary.html --global && \
yarn config set chromedriver_cdnurl https://cdn.npmmirror.com/binaries/chromedriver --global && \
yarn config set operadriver_cdnurl https://cdn.npmmirror.com/binaries/operadriver --global && \
yarn config set phantomjs_cdnurl https://cdn.npmmirror.com/binaries/phantomjs --global && \
yarn config set selenium_cdnurl https://cdn.npmmirror.com/binaries/selenium --global && \
yarn config set node_inspector_cdnurl https://cdn.npmmirror.com/binaries/node-inspector --global

RUN yarn

RUN yarn build

COPY ./jvue-front .

# 注意这个一定要要在npm install后面,否则devDependencies的包无法安装
# 注意这个一定要要在yarn后面,否则devDependencies的包无法安装
ENV HOST 0.0.0.0

CMD ["npm", "run", "start"]
CMD ["yarn", "start"]

1 comment on commit 1f35191

@vercel
Copy link

@vercel vercel bot commented on 1f35191 Aug 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.