diff --git a/dev.Dockerfile b/dev.Dockerfile new file mode 100644 index 0000000..be27dd3 --- /dev/null +++ b/dev.Dockerfile @@ -0,0 +1,80 @@ +# syntax=docker/dockerfile:1.3-labs +ARG NODE_VERSION + +FROM node:${NODE_VERSION}-alpine AS base +RUN apk add --no-cache cpio findutils git +WORKDIR /src + +FROM base AS deps +RUN --mount=type=bind,target=.,rw \ + --mount=type=cache,target=/src/node_modules <&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"' + echo "$diff" + exit 1 +fi +EOT + +FROM deps AS build +RUN --mount=type=bind,target=.,rw \ + --mount=type=cache,target=/src/node_modules <&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"' + echo "$diff" + exit 1 +fi +EOT + +FROM deps AS format +RUN --mount=type=bind,target=.,rw \ + --mount=type=cache,target=/src/node_modules <&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'; \ - git status --porcelain -- dist; \ - exit 1; \ - fi - -FROM deps AS format -RUN --mount=type=bind,target=.,rw \ - --mount=type=cache,target=/src/node_modules \ - yarn run format \ - && mkdir /out && find . -name '*.ts' -not -path './node_modules/*' | cpio -pdm /out - -FROM scratch AS format-update -COPY --from=format /out / - -FROM deps AS format-validate -RUN --mount=type=bind,target=.,rw \ - --mount=type=cache,target=/src/node_modules \ - yarn run format-check diff --git a/hack/test.Dockerfile b/hack/test.Dockerfile deleted file mode 100644 index 06c5d67..0000000 --- a/hack/test.Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -# syntax=docker/dockerfile:1.2 -ARG NODE_VERSION - -FROM node:${NODE_VERSION}-alpine AS base -RUN apk add --no-cache git -WORKDIR /src - -FROM base AS deps -RUN --mount=type=bind,target=.,rw \ - --mount=type=cache,target=/src/node_modules \ - yarn install - -FROM deps AS test -ENV RUNNER_TEMP=/tmp/github_runner -ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache -RUN --mount=type=bind,target=.,rw \ - --mount=type=cache,target=/src/node_modules \ - yarn run test --coverageDirectory=/tmp/coverage - -FROM scratch AS test-coverage -COPY --from=test /tmp/coverage / diff --git a/hack/vendor.Dockerfile b/hack/vendor.Dockerfile deleted file mode 100644 index dd7906b..0000000 --- a/hack/vendor.Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -# syntax=docker/dockerfile:1.2 -ARG NODE_VERSION - -FROM node:${NODE_VERSION}-alpine AS base -RUN apk add --no-cache git -WORKDIR /src - -FROM base AS vendored -RUN --mount=type=bind,target=.,rw \ - --mount=type=cache,target=/src/node_modules \ - yarn install && mkdir /out && cp yarn.lock /out - -FROM scratch AS update -COPY --from=vendored /out / - -FROM vendored AS validate -RUN --mount=type=bind,target=.,rw \ - git add -A && cp -rf /out/* .; \ - if [ -n "$(git status --porcelain -- yarn.lock)" ]; then \ - echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"'; \ - git status --porcelain -- yarn.lock; \ - exit 1; \ - fi