1
0
mirror of https://github.com/142vip/408CSFamily.git synced 2026-04-13 12:59:52 +08:00

perf(镜像): 使用Layer缓存信息,提高Docker构建、打包速度

This commit is contained in:
142vip.cn
2023-11-21 08:57:42 +08:00
parent 38afb538b4
commit 1b3c69edfa

View File

@@ -9,13 +9,18 @@
FROM registry.cn-hangzhou.aliyuncs.com/142vip/node:18.18.0-alpine AS build_base
ARG CONTAINER_BUILD
## 设置环境变量支持容器构建时使用layer缓存参考https://pnpm.io/zh/docker
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
WORKDIR /apps
COPY . .
RUN echo $CONTAINER_BUILD;
## 基于容器自动构建
RUN if [ "$CONTAINER_BUILD" = "true" ]; then \
RUN --mount=type=cache,id=pnpm,target=/pnpm/store if [ "$CONTAINER_BUILD" = "true" ]; then \
sh ./scripts/ci && pnpm build; \
fi;