Skip to content

Commit

Permalink
perf: 构建时使用缓存 (#700)
Browse files Browse the repository at this point in the history
* perf: 构建时使用缓存

* perf: 使用 yarn 构建

Co-authored-by: 吴小白 <296015668@qq.com>
  • Loading branch information
fit2bot and wojiushixiaobai committed Sep 29, 2022
1 parent 1c5b329 commit fa7744c
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions Dockerfile
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

0 comments on commit fa7744c

Please sign in to comment.