@@ -4,10 +4,12 @@ ARG NODE_VERSION=16
44
55FROM node:${NODE_VERSION}-alpine AS base
66RUN apk add --no-cache cpio findutils git
7+ RUN yarn config set --home enableTelemetry 0
78WORKDIR /src
89
910FROM base AS deps
1011RUN --mount=type=bind,target=.,rw \
12+ --mount=type=cache,target=/src/.yarn/cache \
1113 --mount=type=cache,target=/src/node_modules \
1214 yarn install && mkdir /vendor && cp yarn.lock /vendor
1315
@@ -16,18 +18,19 @@ COPY --from=deps /vendor /
1618
1719FROM deps AS vendor-validate
1820RUN --mount=type=bind,target=.,rw <<EOT
19- set -e
20- git add -A
21- cp -rf /vendor/* .
22- if [ -n "$(git status --porcelain -- yarn.lock)" ]; then
23- echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update "'
24- git status --porcelain -- yarn.lock
25- exit 1
26- fi
21+ set -e
22+ git add -A
23+ cp -rf /vendor/* .
24+ if [ -n "$(git status --porcelain -- yarn.lock)" ]; then
25+ echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor"'
26+ git status --porcelain -- yarn.lock
27+ exit 1
28+ fi
2729EOT
2830
2931FROM deps AS build
3032RUN --mount=type=bind,target=.,rw \
33+ --mount=type=cache,target=/src/.yarn/cache \
3134 --mount=type=cache,target=/src/node_modules \
3235 yarn run build && mkdir /out && cp -Rf dist /out/
3336
@@ -36,26 +39,27 @@ COPY --from=build /out /
3639
3740FROM build AS build-validate
3841RUN --mount=type=bind,target=.,rw <<EOT
39- set -e
40- git add -A
41- cp -rf /out/* .
42- if [ -n "$(git status --porcelain -- dist)" ]; then
43- echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
44- git status --porcelain -- dist
45- exit 1
46- fi
42+ set -e
43+ git add -A
44+ cp -rf /out/* .
45+ if [ -n "$(git status --porcelain -- dist)" ]; then
46+ echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
47+ git status --porcelain -- dist
48+ exit 1
49+ fi
4750EOT
4851
4952FROM deps AS format
5053RUN --mount=type=bind,target=.,rw \
5154 --mount=type=cache,target=/src/node_modules \
5255 yarn run format \
53- && mkdir /out && find . -name '*.ts' -not -path './node_modules/*' | cpio -pdm /out
56+ && mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out
5457
5558FROM scratch AS format-update
5659COPY --from=format /out /
5760
5861FROM deps AS lint
5962RUN --mount=type=bind,target=.,rw \
63+ --mount=type=cache,target=/src/.yarn/cache \
6064 --mount=type=cache,target=/src/node_modules \
6165 yarn run lint
0 commit comments