From 6b846db35e9459435efb37236b7347a59f62ebb3 Mon Sep 17 00:00:00 2001 From: "codepress-dev[bot]" <202219725+codepress-dev[bot]@users.noreply.github.com> Date: Sat, 25 Jul 2026 20:47:25 +0000 Subject: [PATCH] Bootstrap CodePress Live Dev Server recipe + dev Dockerfile Author the committed Live Dev Server artifacts for this repo: - .codepress/dev-server/recipe.json (schema_version 1) with one frontends[] entry for the CRA app in web/ (yarn, port 3000, procps). - .codepress/dev-server/Dockerfile.web: thin, dev-mode image on the full node:18-bookworm base. Binds 0.0.0.0 via CODEPRESS_BIND_HOST, wires HMR to the CODEPRESS_HMR_* env vars, bakes no node_modules/source and no CodePress binary. Node 18 + --openssl-legacy-provider because web/ pins react-scripts 1.0.10 (webpack 2.6.1, md4 hashing). No staging backend URL was confidently detected (no .env files, CI workflows, or rewrites), so staging_backend_url is omitted. The Django app in server/ carries no CORS surface (no django-cors-headers, no allowlist; it serves the built React bundle same-origin) and the repo has no staging config path, so no preview-CORS edit was made. Co-authored-by: dev@codepress.dev --- .codepress/dev-server/Dockerfile.web | 59 ++++++++++++++++++++++++++++ .codepress/dev-server/recipe.json | 22 +++++++++++ 2 files changed, 81 insertions(+) create mode 100644 .codepress/dev-server/Dockerfile.web create mode 100644 .codepress/dev-server/recipe.json diff --git a/.codepress/dev-server/Dockerfile.web b/.codepress/dev-server/Dockerfile.web new file mode 100644 index 0000000..0305c0b --- /dev/null +++ b/.codepress/dev-server/Dockerfile.web @@ -0,0 +1,59 @@ +# Generated by CodePress bootstrap-dev-server. +# Dev-mode image for the "web" frontend (Live Dev Server). +# Edits are preserved, but running /codepress-bootstrap-dev-server again may overwrite them. + +# Node 18 (full bookworm, never -slim: the runtime install needs the node-gyp +# toolchain) is the newest LTS this toolchain tolerates — web/ pins +# react-scripts 1.0.10 / webpack 2.6.1, whose md4 content hashing needs +# --openssl-legacy-provider on any Node linked against OpenSSL 3. +FROM public.ecr.aws/docker/library/node:18-bookworm + +# System packages the dev runtime needs. `procps` only: this app's dependency +# tree has no source-built native module (fsevents is darwin-only and skipped +# on linux), so no extra apt library is required. +RUN apt-get update \ + && apt-get install -y --no-install-recommends procps \ + && rm -rf /var/lib/apt/lists/* + +# yarn classic: web/yarn.lock is a v1 lockfile and package.json declares no +# `packageManager`, so just enable corepack's yarn shim — no app install here. +RUN corepack enable + +WORKDIR /app + +# THIN image: no `node_modules`, no source COPY. The dev-server runtime provides +# dependencies at run time (squashfs hydration, or `yarn install +# --frozen-lockfile` in this image against the bind-mounted checkout). Only the +# toolchain lives here. + +# HMR + bind config — values come from the runtime, never hardcoded. +# BROWSER=none react-scripts must not try to open a browser. +# DANGEROUSLY_DISABLE_HOST_CHECK webpack-dev-server 2.x rejects a proxied +# preview Host header otherwise. Already +# off in this app (no `proxy` field), set +# so adding one later can't break previews. +# NODE_OPTIONS=--openssl-legacy-provider webpack 2's md4 hashing on OpenSSL 3. +ENV HOSTNAME=0.0.0.0 \ + CODEPRESS_BIND_HOST=0.0.0.0 \ + PORT=3000 \ + CODEPRESS_HMR_CLIENT_PORT=443 \ + CODEPRESS_HMR_PROTOCOL=wss \ + BROWSER=none \ + DANGEROUSLY_DISABLE_HOST_CHECK=true \ + NODE_OPTIONS=--openssl-legacy-provider + +WORKDIR /app/web +EXPOSE 3000 + +# Put the app + root bins on PATH as a backstop so anything the dev command +# shells out to resolves node_modules/.bin. These dirs are populated at run time +# on the bind-mounted checkout. Prepend, never replace ${PATH}. +ENV PATH="/app/web/node_modules/.bin:/app/node_modules/.bin:${PATH}" + +# Dev command (HMR on). `react-scripts start` reads HOST and PORT from env, so +# bind comes from CODEPRESS_BIND_HOST. Its HMR client (react-dev-utils 3.x) +# builds the sockjs URL from window.location — the public preview origin — so +# the browser side needs no client-port flag; WDS_SOCKET_PORT is exported from +# CODEPRESS_HMR_CLIENT_PORT for the uniform runtime contract and for newer +# react-scripts, which reads it. Invoked through yarn, never a bare bin. +CMD ["sh", "-c", "export HOST=\"${CODEPRESS_BIND_HOST:-0.0.0.0}\" PORT=\"${PORT:-3000}\" WDS_SOCKET_PORT=\"${CODEPRESS_HMR_CLIENT_PORT:-443}\" && exec yarn start"] diff --git a/.codepress/dev-server/recipe.json b/.codepress/dev-server/recipe.json new file mode 100644 index 0000000..1c2b564 --- /dev/null +++ b/.codepress/dev-server/recipe.json @@ -0,0 +1,22 @@ +{ + "schema_version": 1, + "bootstrapped_at": "2026-07-25T20:42:00Z", + "discovery_branch": "master", + "frontends": [ + { + "label": "web", + "working_dir": "web", + "dockerfile_path": ".codepress/dev-server/Dockerfile.web", + "dev_command": "sh -c 'export HOST=\"${CODEPRESS_BIND_HOST:-0.0.0.0}\" PORT=\"${PORT:-3000}\" WDS_SOCKET_PORT=\"${CODEPRESS_HMR_CLIENT_PORT:-443}\" BROWSER=none DANGEROUSLY_DISABLE_HOST_CHECK=true NODE_OPTIONS=--openssl-legacy-provider && exec yarn start'", + "prebuild_command": "", + "prebuild_inputs": [], + "framework": "cra", + "package_manager": "yarn", + "install_command": "yarn install --frozen-lockfile", + "dependency_manifests": ["web/yarn.lock"], + "dev_port": 3000, + "system_packages": ["procps"], + "size": "small" + } + ] +}