-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* perf: 构建时使用缓存 * perf: 使用 yarn 构建 Co-authored-by: 吴小白 <296015668@qq.com>
- Loading branch information
1 parent
1c5b329
commit fa7744c
Showing
1 changed file
with
14 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
FROM node:10 as stage-build | ||
FROM node:14.16 as stage-build | ||
ARG TARGETARCH | ||
ARG VERSION | ||
ENV VERSION=$VERSION | ||
ARG NPM_REGISTRY="https://registry.npmmirror.com" | ||
ENV NPM_REGISTY=$NPM_REGISTRY | ||
ARG SASS_BINARY_SITE="https://npmmirror.com/mirrors/node-sass" | ||
ENV SASS_BINARY_SITE=$SASS_BINARY_SITE | ||
|
||
WORKDIR /data | ||
|
||
# Install deps | ||
RUN npm config set sass_binary_site=${SASS_BINARY_SITE} | ||
RUN npm config set registry ${NPM_REGISTRY} | ||
COPY package.json package-lock.json /data/ | ||
COPY utils /data/utils | ||
RUN cd utils && bash -ixeu build.sh dep | ||
RUN set -ex \ | ||
&& npm config set registry ${NPM_REGISTRY} \ | ||
&& yarn config set registry ${NPM_REGISTRY} \ | ||
&& yarn config set cache-folder /root/.cache/yarn/luna | ||
|
||
ARG VERSION | ||
ENV VERSION=$VERSION | ||
# Build | ||
ADD . /data | ||
RUN cd utils && ls .. && bash -ixeu build.sh build | ||
RUN RUN --mount=type=cache,target=/root/.cache/yarn \ | ||
sed -i "s@[0-9].[0-9].[0-9]@${VERSION}@g" src/environments/environment.prod.ts \ | ||
&& yarn install \ | ||
&& yarn build \ | ||
&& cp -R src/assets/i18n luna/ | ||
|
||
FROM nginx:alpine | ||
COPY --from=stage-build /data/release/luna /opt/luna/ | ||
COPY --from=stage-build /data/luna /opt/luna | ||
COPY nginx.conf /etc/nginx/conf.d/default.conf |