mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-21 13:34:04 +03:00
* ci: move to pnpm 12, pnpm/setup v3 and faster, pinned CI
pnpm 12.6.0 is declared in devEngines.packageManager instead of
packageManager, so pnpm/setup, the Dockerfile and local installs all pick
the same version; the lockfile records the resolved binary. Every workflow
moves to pnpm/setup v3, and the Vercel workflows gain a setup step so
`vercel build` runs with that pnpm rather than whatever is on the runner.
CI time:
- ci runs format check, lint, unit tests, typecheck and build as parallel
steps instead of one after another.
- E2E builds the app once and shares dist with the three browser jobs
instead of rebuilding it in each.
- ci and E2E cancel superseded runs on the same ref.
- The Docker latest/baseurl workflows no longer repeat ci's checks. They
run on workflow_run after ci succeeds for a push, and build the commit
ci tested.
Runners are pinned to ubuntu-26.04-arm. CodeQL stays on x64
(ubuntu-26.04): only the x64 image ships the CodeQL bundle in its tool
cache. The Playwright cache key now includes the runner architecture.
Every action is pinned to its latest release by commit SHA with a version
comment, the Dockerfile base images by digest, and the pnpm and Vercel CLI
installs to exact versions, matching the Renovate presets already enabled
(helpers:pinGitHubActionDigests, docker:pinDigests).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017s2w39tKNdBdD8kyfThuLy
* ci: deploy to Vercel from one workflow with previews and a concurrency group
Replaces sharevb-vercel-preview.yml and sharevb-vercel-prod.yml with
deploy.yaml, which builds here and deploys the prebuilt output:
- One concurrency group per ref with cancel-in-progress, so a burst of
pushes costs one deployment instead of one per push.
- A GitHub environment per run (Production or Preview), which restores the
Environments sidebar and the PR's "View deployment" button.
- Pull requests build their own head commit, named after the PR branch so
Vercel shows the branch rather than "HEAD"; runs from forks are skipped,
since they get no secrets.
- Fails early on missing secrets, refuses to deploy a build without
index.html, and pins the Vercel CLI.
The production hostname for sitemap.xml and robots.txt comes from the
VERCEL_PRODUCTION_URL repository variable instead of being hardcoded, so
the same file serves any deployment. Secrets can live on the repository
or on the Production/Preview environments.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017s2w39tKNdBdD8kyfThuLy
* build: stop compiling tree-sitter's native addon
curlconverter depends on tree-sitter and tree-sitter-bash for its Node
shell parser, but the app only uses curlconverter in the browser, where its
`browser` field swaps in web-tree-sitter (WASM). The native addon is never
loaded.
Building it anyway broke installs: tree-sitter 0.21 ships prebuilds only for
darwin-x64 and win32-x64, so Linux compiles it from source, and its C++17
flags fail against Node 24.21's headers, which require C++20. That is what
failed pnpm install on the arm64 runners.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017s2w39tKNdBdD8kyfThuLy
* ci(e2e): run the browser jobs on x64
On ubuntu-26.04-arm the Playwright suite ran over 7x slower: chromium was
still in the test step after 27 minutes, against under 4 on x64. The build
job stays on arm; its output is architecture-independent.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017s2w39tKNdBdD8kyfThuLy
* test(e2e): stop the preview server with SIGTERM so runs exit
pnpm 12 starts the script it runs in its own process group. Playwright
stops its webServer by SIGKILLing the `pnpm preview` process group, which
no longer contains vite: vite survives, keeps the output pipes open, and
Playwright waits on it forever. The E2E jobs finished every test and then
hung until the job timeout.
pnpm 12.6 forwards SIGTERM to the script it runs, so stop the server with
SIGTERM instead. Locally with pnpm 12.6.0: 112 tests in 1.8 min, clean
exit, nothing left listening on the port.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017s2w39tKNdBdD8kyfThuLy
* Revert "ci(e2e): run the browser jobs on x64"
The slowdown blamed on arm was the Playwright webServer hang fixed in the
previous commit: every test had finished and the job was waiting on an
orphaned vite process. The suite is not slower on arm, so the browser jobs
go back to ubuntu-26.04-arm like the rest.
This reverts commit 9f5af383.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017s2w39tKNdBdD8kyfThuLy
* ci(docker): publish one image at a time, newest wins
Two workflow_run publishes could overlap, and whichever finished last set
the tags, even if it built the older commit. A single concurrency group per
workflow with cancel-in-progress fixes that: ci already cancels superseded
runs on the branch, so publishes arrive in commit order and cancelling the
older one leaves the newest commit on the tags. Raised in review.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017s2w39tKNdBdD8kyfThuLy
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: sharevb <sharevb@gmail.com>
71 lines
3.2 KiB
Docker
71 lines
3.2 KiB
Docker
# build stage
|
|
FROM --platform=$BUILDPLATFORM node:24-alpine@sha256:ebfe2f90462722a7a4de65e91990e97fe0d401c70e0e762c5b53302f905ec1c1 AS build-stage
|
|
# Set environment variables for non-interactive npm installs
|
|
ENV NPM_CONFIG_LOGLEVEL=warn
|
|
ENV CI=true
|
|
|
|
RUN apk add --update python3 make g++\
|
|
&& rm -rf /var/cache/apk/*
|
|
|
|
WORKDIR /app
|
|
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
|
COPY patches patches
|
|
COPY stubs stubs
|
|
RUN npm install -g pnpm@12.6.0 && pnpm i --ignore-scripts --frozen-lockfile
|
|
COPY . .
|
|
# Deliberately no BASE_URL here: the bundle is built path-agnostic (relative asset URLs
|
|
# plus a `<base href="/">` in index.html) so that one image can be served from any
|
|
# subpath. The path is a runtime setting instead -- see the BASE_URL environment variable
|
|
# on the production stage below.
|
|
ARG VITE_AVAILABLE_LOCALES
|
|
ENV VITE_AVAILABLE_LOCALES=${VITE_AVAILABLE_LOCALES}
|
|
ENV VITE_VERCEL_ENV=production
|
|
RUN pnpm build
|
|
|
|
# production stage
|
|
FROM nginxinc/nginx-unprivileged:stable-alpine@sha256:4714e0b1b2577eaa1a6131d07c958b67f0eb68e6d0521e90c6e5287db8cf0bc5 AS production-stage
|
|
|
|
LABEL maintainer="ShareVB <sharevb@gmail.com>" \
|
|
org.opencontainers.image.authors="ShareVB <sharevb@gmail.com>"
|
|
LABEL org.opencontainers.image.source=github.com/sharevb/it-tools
|
|
|
|
ENV VITE_VERCEL_ENV=production
|
|
|
|
# The path the app is served under. Override it at run time -- `docker run -e
|
|
# BASE_URL=/it-tools/`, `environment: BASE_URL: /it-tools/` in a compose file -- and nginx
|
|
# rewrites the `<base href>` in index.html on the way out; nothing is baked in. The build
|
|
# arg only moves the default, for anyone who prefers to ship an image that is preconfigured
|
|
# for a subpath. See docker-entrypoint.d/18-resolve-base-url.envsh and nginx.conf.
|
|
ARG BASE_URL=/
|
|
ENV BASE_URL=${BASE_URL}
|
|
|
|
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
|
|
|
COPY nginx.conf /etc/nginx/templates/default.conf.template
|
|
COPY docker-entrypoint.d/ /docker-entrypoint.d/
|
|
ENV PORT=8080
|
|
|
|
# nginx defaults to `worker_processes auto`, which counts the host's cores and
|
|
# ignores the container's cpu limit. On a large host that is hundreds of
|
|
# workers in a small container: `docker run -m 192m` is enough to get the
|
|
# image OOM-killed on startup. Let the entrypoint size the pool from the cgroup
|
|
# cpu quota instead. Uncapped containers still get one worker per core.
|
|
ENV NGINX_ENTRYPOINT_WORKER_PROCESSES_AUTOTUNE=1
|
|
|
|
# Render the template once here as well. The entrypoint normally re-renders it
|
|
# at startup, so a custom $PORT keeps working, but it cannot do so on a
|
|
# read-only filesystem (see docker-entrypoint.d/19-skip-envsubst-if-readonly.envsh).
|
|
# Without this the image would fall back to the stock welcome config from the
|
|
# base image: no SPA fallback, so deep links 404 on refresh, and no COOP/COEP,
|
|
# so the WebAssembly-backed tools stop working.
|
|
# Sourcing the entrypoint's own resolver keeps the baked-in BASE_URL normalised and
|
|
# validated exactly the way a runtime one would be.
|
|
RUN . /docker-entrypoint.d/18-resolve-base-url.envsh \
|
|
&& envsubst '${PORT} ${BASE_URL} ${BASE_URL_REGEX} ${BASE_URL_NO_SLASH_REGEX}' \
|
|
< /etc/nginx/templates/default.conf.template \
|
|
> /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE $PORT
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|