From 50f5b1fd456ca95dfd675d9b4da16cfdf69f9a67 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Thu, 28 May 2026 18:30:50 +0300 Subject: [PATCH] set devEngines in bskyembed --- Dockerfile.embedr | 76 +++++---- bskyembed/package.json | 15 ++ bskyembed/pnpm-lock.yaml | 325 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 383 insertions(+), 33 deletions(-) diff --git a/Dockerfile.embedr b/Dockerfile.embedr index b134bfa486..5f461d1830 100644 --- a/Dockerfile.embedr +++ b/Dockerfile.embedr @@ -1,14 +1,45 @@ -FROM golang:1.26-bookworm AS build-env +# +# Stage 1: build the embed bundle with pnpm. +# +# Uses the official pnpm image. Node is auto-downloaded by pnpm using the +# `devEngines.runtime` field in package.json (onFail: "download"). +# +FROM ghcr.io/pnpm/pnpm:11 AS web-build -WORKDIR /usr/src/social-app +WORKDIR /app ENV DEBIAN_FRONTEND=noninteractive -# Node -ENV NODE_VERSION=24.15.0 -ENV NVM_DIR=/usr/share/nvm +# +# pnpm config +# +ENV CI=1 +# use the pnpm version specified in package.json +ENV pnpm_config_pm_on_fail=download + +COPY . . + +RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile + +# bskyembed is a separate (non-workspace) pnpm project, so install its deps too. +RUN --mount=type=cache,id=pnpm,target=/pnpm/store cd bskyembed && pnpm install --frozen-lockfile + +RUN pnpm intl:build + +RUN pnpm build-embed + +# +# Stage 2: build the embedr Go binary, embedding the assets from stage 1. +# +# post-embed-build.js (run by `pnpm build-embed` above) writes the bundled +# assets/templates into bskyweb/embedr-static and bskyweb/embedr-templates, +# so copying the bskyweb/ tree from stage 1 is enough for go:embed to find +# everything. +# +FROM golang:1.26-bookworm AS go-build + +WORKDIR /usr/src/social-app -# Go ENV GODEBUG="netdns=go" ENV GOOS="linux" ARG TARGETARCH @@ -16,40 +47,16 @@ ENV GOARCH=${TARGETARCH:-amd64} ENV CGO_ENABLED=1 ENV GOEXPERIMENT="loopvar" -# CI environment for pnpm -ENV CI=true - -COPY . . - -# -# Generate the JavaScript webpack. NOTE: this will change -# -RUN mkdir --parents $NVM_DIR && \ - wget \ - --output-document=/tmp/nvm-install.sh \ - https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh && \ - bash /tmp/nvm-install.sh - -RUN \. "$NVM_DIR/nvm.sh" && \ - nvm install $NODE_VERSION && \ - nvm use $NODE_VERSION && \ - npm install --global pnpm@11.1.3 && \ - pnpm install --frozen-lockfile && \ - cd bskyembed && pnpm install --frozen-lockfile && cd .. && \ - pnpm intl:build && \ - pnpm build-embed +COPY --from=web-build /app/bskyweb ./bskyweb # DEBUG -RUN find ./bskyweb/embedr-static && find ./bskyweb/embedr-templates && find ./bskyembed/dist +RUN find ./bskyweb/embedr-static && find ./bskyweb/embedr-templates # hack around issue with empty directory and go:embed RUN touch bskyweb/static/js/empty.txt RUN touch bskyweb/static/css/empty.txt RUN touch bskyweb/static/media/empty.txt -# -# Generate the embedr Go binary. -# RUN cd bskyweb/ && \ go mod download && \ go mod verify @@ -62,6 +69,9 @@ RUN cd bskyweb/ && \ -o /embedr \ ./cmd/embedr +# +# Stage 3: runtime image. +# FROM debian:bookworm-slim ENV GODEBUG=netdns=go @@ -75,7 +85,7 @@ RUN apt-get update && apt-get install --yes \ ENTRYPOINT ["dumb-init", "--"] WORKDIR /embedr -COPY --from=build-env /embedr /usr/bin/embedr +COPY --from=go-build /embedr /usr/bin/embedr CMD ["/usr/bin/embedr"] diff --git a/bskyembed/package.json b/bskyembed/package.json index 7d6b62cf6c..f38a8f2b25 100644 --- a/bskyembed/package.json +++ b/bskyembed/package.json @@ -2,6 +2,21 @@ "name": "bskyembed", "version": "0.0.0", "type": "module", + "engines": { + "node": ">=24.15.0" + }, + "devEngines": { + "packageManager": { + "name": "pnpm", + "version": "11.1.3", + "onFail": "warn" + }, + "runtime": { + "name": "node", + "version": "^24.15.0", + "onFail": "download" + } + }, "scripts": { "dev": "vite", "dev-snippet": "tsc --project tsconfig.snippet.json && serve -s dist -p 3000 -n", diff --git a/bskyembed/pnpm-lock.yaml b/bskyembed/pnpm-lock.yaml index fe0c80db65..a705ed0285 100644 --- a/bskyembed/pnpm-lock.yaml +++ b/bskyembed/pnpm-lock.yaml @@ -1,3 +1,202 @@ +--- +lockfileVersion: '9.0' + +importers: + + .: + configDependencies: {} + packageManagerDependencies: + '@pnpm/exe': + specifier: 11.1.3 + version: 11.1.3 + pnpm: + specifier: 11.1.3 + version: 11.1.3 + +packages: + + '@pnpm/exe@11.1.3': + resolution: {integrity: sha512-J6bSMpZlHVUKuMKtPT/+lrFPpvBiOIgk6HnNC3vmoM/fsMgFhao6ITFwdsUMzdCl2qHf9cnVYA4ZBdsGmVUnpg==} + hasBin: true + + '@pnpm/linux-arm64@11.1.3': + resolution: {integrity: sha512-sz3fc0hSqguk2eGe/InelpBD3LP82MzF+8pLzDpYNGuhasGY+VWkuxEo02HczQYRVXTsbpZVepk+Qs2CONc04Q==} + cpu: [arm64] + os: [linux] + + '@pnpm/linux-x64@11.1.3': + resolution: {integrity: sha512-UadJh5fJZWa47OtdZTWLKWDj4z5WpZFB5pS2wOh/kfKypUmQyjmbOMClP7/yJGS2ZtrSjRgYjIEWAjndkWsMaA==} + cpu: [x64] + os: [linux] + + '@pnpm/linuxstatic-arm64@11.1.3': + resolution: {integrity: sha512-lWmGr96w+VrIRVsEfTXROB3GeQNxrX2Hy32j3USHr6WlqmpH1i7YjavJGpoXeVZbb77fCFjNFAtsJzGXSgy/Og==} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@pnpm/linuxstatic-x64@11.1.3': + resolution: {integrity: sha512-I74GDBOPbr5TXgob3ct4hv6BQtLGdsjGJrII2qNl/e2xYHXekjIWE4Eh7RGN4C7xu+BZYKtvnOOr149yR7KxUw==} + cpu: [x64] + os: [linux] + libc: [musl] + + '@pnpm/macos-arm64@11.1.3': + resolution: {integrity: sha512-nWn155BVa54iNyg4iolVhjMtqumXHPh8ul5CFjQFJXdwgr9MRUgc5EUBML1+7mS8C/7Wcex5HUgn/w3fliHCsQ==} + cpu: [arm64] + os: [darwin] + + '@pnpm/win-arm64@11.1.3': + resolution: {integrity: sha512-4u6PQL7/WgwdweC2ZJcdCzhM1koRFG5ofcUSrIVsdyo9ePfGq2D9p1rkZbiLEfIGvl3GKOsfMB5DRTgs8es4AQ==} + cpu: [arm64] + os: [win32] + + '@pnpm/win-x64@11.1.3': + resolution: {integrity: sha512-JmhH7ljJ3MWjvWFz/YHbu/27ISCNLZsQb1JG+ib3uHlfUwIJuF6BudXYsbS5Uu0o7xUvC9sPPm+Uho4Or6R3vA==} + cpu: [x64] + os: [win32] + + '@reflink/reflink-darwin-arm64@0.1.19': + resolution: {integrity: sha512-ruy44Lpepdk1FqDz38vExBY/PVUsjxZA+chd9wozjUH9JjuDT/HEaQYA6wYN9mf041l0yLVar6BCZuWABJvHSA==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [darwin] + + '@reflink/reflink-darwin-x64@0.1.19': + resolution: {integrity: sha512-By85MSWrMZa+c26TcnAy8SDk0sTUkYlNnwknSchkhHpGXOtjNDUOxJE9oByBnGbeuIE1PiQsxDG3Ud+IVV9yuA==} + engines: {node: '>= 10'} + cpu: [x64] + os: [darwin] + + '@reflink/reflink-linux-arm64-gnu@0.1.19': + resolution: {integrity: sha512-7P+er8+rP9iNeN+bfmccM4hTAaLP6PQJPKWSA4iSk2bNvo6KU6RyPgYeHxXmzNKzPVRcypZQTpFgstHam6maVg==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@reflink/reflink-linux-arm64-musl@0.1.19': + resolution: {integrity: sha512-37iO/Dp6m5DDaC2sf3zPtx/hl9FV3Xze4xoYidrxxS9bgP3S8ALroxRK6xBG/1TtfXKTvolvp+IjrUU6ujIGmA==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@reflink/reflink-linux-x64-gnu@0.1.19': + resolution: {integrity: sha512-jbI8jvuYCaA3MVUdu8vLoLAFqC+iNMpiSuLbxlAgg7x3K5bsS8nOpTRnkLF7vISJ+rVR8W+7ThXlXlUQ93ulkw==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@reflink/reflink-linux-x64-musl@0.1.19': + resolution: {integrity: sha512-e9FBWDe+lv7QKAwtKOt6A2W/fyy/aEEfr0g6j/hWzvQcrzHCsz07BNQYlNOjTfeytrtLU7k449H1PI95jA4OjQ==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + libc: [musl] + + '@reflink/reflink-win32-arm64-msvc@0.1.19': + resolution: {integrity: sha512-09PxnVIQcd+UOn4WAW73WU6PXL7DwGS6wPlkMhMg2zlHHG65F3vHepOw06HFCq+N42qkaNAc8AKIabWvtk6cIQ==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [win32] + + '@reflink/reflink-win32-x64-msvc@0.1.19': + resolution: {integrity: sha512-E//yT4ni2SyhwP8JRjVGWr3cbnhWDiPLgnQ66qqaanjjnMiu3O/2tjCPQXlcGc/DEYofpDc9fvhv6tALQsMV9w==} + engines: {node: '>= 10'} + cpu: [x64] + os: [win32] + + '@reflink/reflink@0.1.19': + resolution: {integrity: sha512-DmCG8GzysnCZ15bres3N5AHCmwBwYgp0As6xjhQ47rAUTUXxJiK+lLUxaGsX3hd/30qUpVElh05PbGuxRPgJwA==} + engines: {node: '>= 10'} + + detect-libc@2.1.2: + resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} + engines: {node: '>=8'} + + pnpm@11.1.3: + resolution: {integrity: sha512-yFNX/hfKEt0j3XBxgiZm39fjy3b+IU4zcLXqL7NPKiMRhVCbY+cX880KyzjdP42CvNXoFyQArmeLcOpPvtCJbQ==} + engines: {node: '>=22.13'} + hasBin: true + +snapshots: + + '@pnpm/exe@11.1.3': + dependencies: + '@reflink/reflink': 0.1.19 + detect-libc: 2.1.2 + optionalDependencies: + '@pnpm/linux-arm64': 11.1.3 + '@pnpm/linux-x64': 11.1.3 + '@pnpm/linuxstatic-arm64': 11.1.3 + '@pnpm/linuxstatic-x64': 11.1.3 + '@pnpm/macos-arm64': 11.1.3 + '@pnpm/win-arm64': 11.1.3 + '@pnpm/win-x64': 11.1.3 + + '@pnpm/linux-arm64@11.1.3': + optional: true + + '@pnpm/linux-x64@11.1.3': + optional: true + + '@pnpm/linuxstatic-arm64@11.1.3': + optional: true + + '@pnpm/linuxstatic-x64@11.1.3': + optional: true + + '@pnpm/macos-arm64@11.1.3': + optional: true + + '@pnpm/win-arm64@11.1.3': + optional: true + + '@pnpm/win-x64@11.1.3': + optional: true + + '@reflink/reflink-darwin-arm64@0.1.19': + optional: true + + '@reflink/reflink-darwin-x64@0.1.19': + optional: true + + '@reflink/reflink-linux-arm64-gnu@0.1.19': + optional: true + + '@reflink/reflink-linux-arm64-musl@0.1.19': + optional: true + + '@reflink/reflink-linux-x64-gnu@0.1.19': + optional: true + + '@reflink/reflink-linux-x64-musl@0.1.19': + optional: true + + '@reflink/reflink-win32-arm64-msvc@0.1.19': + optional: true + + '@reflink/reflink-win32-x64-msvc@0.1.19': + optional: true + + '@reflink/reflink@0.1.19': + optionalDependencies: + '@reflink/reflink-darwin-arm64': 0.1.19 + '@reflink/reflink-darwin-x64': 0.1.19 + '@reflink/reflink-linux-arm64-gnu': 0.1.19 + '@reflink/reflink-linux-arm64-musl': 0.1.19 + '@reflink/reflink-linux-x64-gnu': 0.1.19 + '@reflink/reflink-linux-x64-musl': 0.1.19 + '@reflink/reflink-win32-arm64-msvc': 0.1.19 + '@reflink/reflink-win32-x64-msvc': 0.1.19 + + detect-libc@2.1.2: {} + + pnpm@11.1.3: {} + +--- lockfileVersion: '9.0' settings: @@ -39,6 +238,9 @@ importers: globals: specifier: ^15.14.0 version: 15.15.0 + node: + specifier: runtime:^24.15.0 + version: runtime:24.16.0 postcss: specifier: ^8.4.38 version: 8.5.14 @@ -1816,6 +2018,127 @@ packages: node-releases@2.0.44: resolution: {integrity: sha512-5WUyunoPMsvvEhS8AxHtRzP+oA8UCkJ7YRxatWKjngndhDGLiqEVAQKWjFAiAiuL8zMRGzGSJxFnLetoa43qGQ==} + node@runtime:24.16.0: + resolution: + type: variations + variants: + - resolution: + archive: tarball + bin: + node: bin/node + integrity: sha256-MN/Y5EMiwnEoE/JeFjwlPK1TvkPgmJB7i1NIvxdKSWg= + type: binary + url: https://nodejs.org/download/release/v24.16.0/node-v24.16.0-aix-ppc64.tar.gz + targets: + - cpu: ppc64 + os: aix + - resolution: + archive: tarball + bin: + node: bin/node + integrity: sha256-ORidq07rFXBsQkrwrAijBEyeSPfbEqfXf2t6r8fdXfY= + type: binary + url: https://nodejs.org/download/release/v24.16.0/node-v24.16.0-darwin-arm64.tar.gz + targets: + - cpu: arm64 + os: darwin + - resolution: + archive: tarball + bin: + node: bin/node + integrity: sha256-KYtMezy4B2XIcD5CuQMkpOzjtmNJR7iedpw8mAq1UYU= + type: binary + url: https://nodejs.org/download/release/v24.16.0/node-v24.16.0-darwin-x64.tar.gz + targets: + - cpu: x64 + os: darwin + - resolution: + archive: tarball + bin: + node: bin/node + integrity: sha256-WJ9bbdT8/uTf2nMBOQPJZquqir2T28nUNlRORytPDnQ= + type: binary + url: https://nodejs.org/download/release/v24.16.0/node-v24.16.0-linux-arm64.tar.gz + targets: + - cpu: arm64 + os: linux + - resolution: + archive: tarball + bin: + node: bin/node + integrity: sha256-JStYIFNNwDBKKFQcmkRDfPpyAufyAiXSjUk5MsWOl6o= + type: binary + url: https://nodejs.org/download/release/v24.16.0/node-v24.16.0-linux-ppc64le.tar.gz + targets: + - cpu: ppc64le + os: linux + - resolution: + archive: tarball + bin: + node: bin/node + integrity: sha256-Vnrwl1s0BVFrmx3cZEKaI+yMWi+mzwE5EmGkzHdOPt0= + type: binary + url: https://nodejs.org/download/release/v24.16.0/node-v24.16.0-linux-s390x.tar.gz + targets: + - cpu: s390x + os: linux + - resolution: + archive: tarball + bin: + node: bin/node + integrity: sha256-L69qOH6bYriI4hxU8BJJ+ydTf/7PGELyn0yRnQpZoP8= + type: binary + url: https://nodejs.org/download/release/v24.16.0/node-v24.16.0-linux-x64.tar.gz + targets: + - cpu: x64 + os: linux + - resolution: + archive: zip + bin: + node: node.exe + integrity: sha256-FINGEdTGs8BgVOcAdzK5BHTBbgsy85XgW1Wlce9xxtI= + prefix: node-v24.16.0-win-arm64 + type: binary + url: https://nodejs.org/download/release/v24.16.0/node-v24.16.0-win-arm64.zip + targets: + - cpu: arm64 + os: win32 + - resolution: + archive: zip + bin: + node: node.exe + integrity: sha256-7aypvVjsjpIDfaxOh31S9rj0MLgcGLV+JktOL7ERzVY= + prefix: node-v24.16.0-win-x64 + type: binary + url: https://nodejs.org/download/release/v24.16.0/node-v24.16.0-win-x64.zip + targets: + - cpu: x64 + os: win32 + - resolution: + archive: tarball + bin: + node: bin/node + integrity: sha256-hd3ieqc1A7A9rfoEEKgABntOP3Avt/yqO+ryhN/Maek= + type: binary + url: https://unofficial-builds.nodejs.org/download/release/v24.16.0/node-v24.16.0-linux-arm64-musl.tar.gz + targets: + - cpu: arm64 + os: linux + libc: musl + - resolution: + archive: tarball + bin: + node: bin/node + integrity: sha256-UN9djUdIktT3uQYWffNvd/W5OQj2PcUy3FaCGcq2WEE= + type: binary + url: https://unofficial-builds.nodejs.org/download/release/v24.16.0/node-v24.16.0-linux-x64-musl.tar.gz + targets: + - cpu: x64 + os: linux + libc: musl + version: 24.16.0 + hasBin: true + normalize-path@3.0.0: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'} @@ -4165,6 +4488,8 @@ snapshots: node-releases@2.0.44: {} + node@runtime:24.16.0: {} + normalize-path@3.0.0: {} npm-run-path@4.0.1: