Some checks failed
ci / main () (push) Has been cancelled
ci / main (cloud:latest) (push) Has been cancelled
ci / main (cloud:v0.11.2-desktop.2) (push) Has been cancelled
ci / main (lab:latest) (push) Has been cancelled
ci / main (latest) (push) Has been cancelled
ci / main (v0.4.1) (push) Has been cancelled
ci / multi (push) Has been cancelled
ci / error (push) Has been cancelled
ci / debug (push) Has been cancelled
ci / install (push) Has been cancelled
ci / use (false) (push) Has been cancelled
ci / use (true) (push) Has been cancelled
ci / driver (image=moby/buildkit:latest) (push) Has been cancelled
ci / driver (image=moby/buildkit:master
network=host
) (push) Has been cancelled
ci / docker-driver (push) Has been cancelled
ci / endpoint (push) Has been cancelled
ci / config (push) Has been cancelled
ci / config-inline (push) Has been cancelled
ci / with-qemu (, all) (push) Has been cancelled
ci / with-qemu (, arm64,riscv64,arm) (push) Has been cancelled
ci / with-qemu (v0.9.1, all) (push) Has been cancelled
ci / with-qemu (v0.9.1, arm64,riscv64,arm) (push) Has been cancelled
ci / build-ref (cb185f095fd3d9444e0aa605d3789e9e05f2a1e7) (push) Has been cancelled
ci / build-ref (master) (push) Has been cancelled
ci / build-ref (refs/pull/731/head) (push) Has been cancelled
ci / build-ref (refs/tags/v0.5.1) (push) Has been cancelled
ci / standalone-cmd (push) Has been cancelled
ci / standalone-action (push) Has been cancelled
ci / standalone-install-error (push) Has been cancelled
ci / append (push) Has been cancelled
ci / platforms (push) Has been cancelled
ci / docker-context (push) Has been cancelled
ci / cleanup (false) (push) Has been cancelled
ci / cleanup (true) (push) Has been cancelled
ci / k3s (v0.10.5) (push) Has been cancelled
ci / k3s (v0.11.0) (push) Has been cancelled
ci / cache-binary (false) (push) Has been cancelled
ci / cache-binary (true) (push) Has been cancelled
81 lines
2.2 KiB
Docker
81 lines
2.2 KiB
Docker
# syntax=docker/dockerfile:1
|
|
|
|
ARG NODE_VERSION=20
|
|
|
|
FROM node:${NODE_VERSION}-alpine AS base
|
|
RUN apk add --no-cache cpio findutils git
|
|
WORKDIR /src
|
|
RUN --mount=type=bind,target=.,rw \
|
|
--mount=type=cache,target=/src/.yarn/cache <<EOT
|
|
corepack enable
|
|
yarn --version
|
|
yarn config set --home enableTelemetry 0
|
|
EOT
|
|
|
|
FROM base AS deps
|
|
RUN --mount=type=bind,target=.,rw \
|
|
--mount=type=cache,target=/src/.yarn/cache \
|
|
--mount=type=cache,target=/src/node_modules \
|
|
yarn install && mkdir /vendor && cp yarn.lock /vendor
|
|
|
|
FROM scratch AS vendor-update
|
|
COPY --from=deps /vendor /
|
|
|
|
FROM deps AS vendor-validate
|
|
RUN --mount=type=bind,target=.,rw <<EOT
|
|
set -e
|
|
git add -A
|
|
cp -rf /vendor/* .
|
|
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then
|
|
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor"'
|
|
git status --porcelain -- yarn.lock
|
|
exit 1
|
|
fi
|
|
EOT
|
|
|
|
FROM deps AS build
|
|
RUN --mount=type=bind,target=.,rw \
|
|
--mount=type=cache,target=/src/.yarn/cache \
|
|
--mount=type=cache,target=/src/node_modules \
|
|
yarn run build && mkdir /out && cp -Rf dist /out/
|
|
|
|
FROM scratch AS build-update
|
|
COPY --from=build /out /
|
|
|
|
FROM build AS build-validate
|
|
RUN --mount=type=bind,target=.,rw <<EOT
|
|
set -e
|
|
git add -A
|
|
cp -rf /out/* .
|
|
if [ -n "$(git status --porcelain -- dist)" ]; then
|
|
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
|
|
git status --porcelain -- dist
|
|
exit 1
|
|
fi
|
|
EOT
|
|
|
|
FROM deps AS format
|
|
RUN --mount=type=bind,target=.,rw \
|
|
--mount=type=cache,target=/src/.yarn/cache \
|
|
--mount=type=cache,target=/src/node_modules \
|
|
yarn run format \
|
|
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out
|
|
|
|
FROM scratch AS format-update
|
|
COPY --from=format /out /
|
|
|
|
FROM deps AS lint
|
|
RUN --mount=type=bind,target=.,rw \
|
|
--mount=type=cache,target=/src/.yarn/cache \
|
|
--mount=type=cache,target=/src/node_modules \
|
|
yarn run lint
|
|
|
|
FROM deps AS test
|
|
RUN --mount=type=bind,target=.,rw \
|
|
--mount=type=cache,target=/src/.yarn/cache \
|
|
--mount=type=cache,target=/src/node_modules \
|
|
yarn run test --coverage --coverageDirectory=/tmp/coverage
|
|
|
|
FROM scratch AS test-coverage
|
|
COPY --from=test /tmp/coverage /
|