perf: 优化构建

This commit is contained in:
吴小白 2022-11-27 21:03:56 +08:00
parent e55272180d
commit 1029d0cfa1

View File

@ -1,23 +1,21 @@
FROM node:14.16 as stage-build FROM node:14.16 as stage-build
ARG TARGETARCH ARG TARGETARCH
ARG NPM_REGISTRY="https://registry.npmmirror.com" ARG NPM_REGISTRY="https://registry.npmmirror.com"
ENV NPM_REGISTY=$NPM_REGISTRY
WORKDIR /data WORKDIR /data
RUN set -ex \ RUN set -ex \
&& npm config set registry ${NPM_REGISTRY} \ && npm config set registry ${NPM_REGISTRY} \
&& yarn config set registry ${NPM_REGISTRY} \ && yarn config set registry ${NPM_REGISTRY}
&& yarn config set cache-folder /root/.cache/yarn/lina
ADD package.json yarn.lock /data ADD package.json yarn.lock /data
RUN --mount=type=cache,target=/root/.cache/yarn \ RUN --mount=type=cache,target=/usr/local/share/.cache/yarn,sharing=locked,id=lina \
yarn install yarn install
ARG VERSION ARG VERSION
ENV VERSION=$VERSION ENV VERSION=$VERSION
ADD . /data ADD . /data
RUN --mount=type=cache,target=/root/.cache/yarn \ RUN --mount=type=cache,target=/usr/local/share/.cache/yarn,sharing=locked,id=lina \
sed -i "s@Version <strong>.*</strong>@Version <strong>${VERSION}</strong>@g" src/layout/components/Footer/index.vue \ sed -i "s@Version <strong>.*</strong>@Version <strong>${VERSION}</strong>@g" src/layout/components/Footer/index.vue \
&& yarn build && yarn build