Skip to content

Commit 36efcb9

Browse files
authored
Merge pull request #214 from crazy-max/fix-vendoring
dockerfile: fix vendoring
2 parents 61e47f6 + 64e9804 commit 36efcb9

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

dev.Dockerfile

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
ARG NODE_VERSION=20
44

55
FROM node:${NODE_VERSION}-alpine AS base
6-
RUN apk add --no-cache cpio findutils git
6+
RUN apk add --no-cache cpio findutils git rsync
77
WORKDIR /src
88
RUN --mount=type=bind,target=.,rw \
99
--mount=type=cache,target=/src/.yarn/cache <<EOT
10+
set -e
1011
corepack enable
1112
yarn --version
1213
yarn config set --home enableTelemetry 0
@@ -27,25 +28,34 @@ RUN --mount=type=bind,target=.,rw <<EOT
2728
git add -A
2829
cp -rf /vendor/* .
2930
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then
30-
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"'
31+
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor"'
3132
git status --porcelain -- yarn.lock
3233
exit 1
3334
fi
3435
EOT
3536

3637
FROM deps AS build
37-
RUN --mount=type=bind,target=.,rw \
38+
RUN --mount=target=/context \
3839
--mount=type=cache,target=/src/.yarn/cache \
39-
--mount=type=cache,target=/src/node_modules \
40-
yarn run build && mkdir /out && cp -Rf dist /out/
40+
--mount=type=cache,target=/src/node_modules <<EOT
41+
set -e
42+
rsync -a /context/. .
43+
rm -rf dist
44+
yarn run build
45+
mkdir /out
46+
cp -r dist /out
47+
EOT
4148

4249
FROM scratch AS build-update
4350
COPY --from=build /out /
4451

4552
FROM build AS build-validate
46-
RUN --mount=type=bind,target=.,rw <<EOT
53+
RUN --mount=target=/context \
54+
--mount=target=.,type=tmpfs <<EOT
4755
set -e
56+
rsync -a /context/. .
4857
git add -A
58+
rm -rf dist
4959
cp -rf /out/* .
5060
if [ -n "$(git status --porcelain -- dist)" ]; then
5161
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
@@ -58,8 +68,7 @@ FROM deps AS format
5868
RUN --mount=type=bind,target=.,rw \
5969
--mount=type=cache,target=/src/.yarn/cache \
6070
--mount=type=cache,target=/src/node_modules \
61-
yarn run format \
62-
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' | cpio -pdm /out
71+
yarn run format && mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out
6372

6473
FROM scratch AS format-update
6574
COPY --from=format /out /

0 commit comments

Comments
 (0)