Browse Source

perf: admin/Dockerfile 挂载包管理器缓存目录

dhb52 1 year ago
parent
commit
c3d9439030
1 changed files with 5 additions and 6 deletions
  1. 5 6
      yudao-ui-admin/Dockerfile

+ 5 - 6
yudao-ui-admin/Dockerfile

@@ -1,11 +1,10 @@
-FROM node:16-alpine as DIST
+FROM node:16-alpine as build-stage
 
 WORKDIR /admim
 
-COPY ./package.json .
-COPY ./yarn.lock .
-COPY ./.npmrc .
-RUN yarn install
+COPY .npmrc package.json yarn.lock ./
+RUN --mount=type=cache,id=yarn-store,target=/root/.yarn-store \
+    yarn install
 
 COPY . .
 ARG NODE_ENV=""
@@ -17,6 +16,6 @@ FROM nginx:alpine
 ENV TZ=Asia/Shanghai
 
 COPY ./nginx.conf /etc/nginx/conf.d/default.conf
-COPY --from=DIST /admim/dist /usr/share/nginx/html
+COPY --from=build-stage /admim/dist /usr/share/nginx/html
 
 EXPOSE 80