From 8e81b6f4f941614ddd14c9cb81adc2570464c931 Mon Sep 17 00:00:00 2001 From: "codepress-dev[bot]" <202219725+codepress-dev[bot]@users.noreply.github.com> Date: Sat, 18 Jul 2026 03:25:07 +0000 Subject: [PATCH] Bootstrap CodePress Live Dev Server recipe + dev Dockerfiles --- .codepress/dev-server/Dockerfile.web | 54 ++++++++++++++++++++++++++++ .codepress/dev-server/recipe.json | 22 ++++++++++++ 2 files changed, 76 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..63edfe6 --- /dev/null +++ b/.codepress/dev-server/Dockerfile.web @@ -0,0 +1,54 @@ +# 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. +FROM public.ecr.aws/docker/library/node:22-bookworm + +# System packages the dev runtime needs. `procps` only: this Create React App has +# no source-built native modules, so no extra apt library is required — add one +# here only for a source-built native module (see the dockerfile contract). +RUN apt-get update \ + && apt-get install -y --no-install-recommends procps \ + && rm -rf /var/lib/apt/lists/* + +# Enable corepack so the repo's yarn (classic, matching web/yarn.lock) resolves. +# No packageManager field is declared, so corepack's default yarn 1.x is used. +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` in this image +# against the bind-mounted checkout). Only the toolchain lives here. + +# HMR + bind config — values come from the runtime, never hardcoded. +# - HOST is CRA's bind var (alias of HOSTNAME); it must be 0.0.0.0 in-container. +# - WDS_SOCKET_PORT points CRA's webpack-dev-server HMR client at the PUBLIC edge +# port (usually 443 behind the wss proxy), not the in-container port. +# - DANGEROUSLY_DISABLE_HOST_CHECK lets the dev server accept the preview host +# header (the CRA analog of Vite's server.allowedHosts). +# - NODE_OPTIONS=--openssl-legacy-provider is required for react-scripts 1.0.10 +# (webpack 3's md4 hashing) to boot on modern Node's OpenSSL 3. +# - BROWSER=none stops react-scripts from trying to open a browser in-container. +ENV HOSTNAME=0.0.0.0 \ + CODEPRESS_BIND_HOST=0.0.0.0 \ + HOST=0.0.0.0 \ + PORT=3000 \ + CODEPRESS_HMR_CLIENT_PORT=443 \ + CODEPRESS_HMR_PROTOCOL=wss \ + WDS_SOCKET_PORT=443 \ + DANGEROUSLY_DISABLE_HOST_CHECK=true \ + BROWSER=none \ + NODE_OPTIONS=--openssl-legacy-provider + +WORKDIR /app/web +EXPOSE 3000 + +# Put the app + root node_modules bins on PATH so a bare bin resolves at runtime +# (deps are hydrated on the bind-mounted checkout by the runtime). Prepend, never +# replace ${PATH}, so the corepack/yarn shims survive. +ENV PATH="/app/web/node_modules/.bin:/app/node_modules/.bin:${PATH}" + +# Dev command (HMR on): react-scripts start via yarn. Map CRA's bind host and the +# HMR client socket port from the runtime env so the browser's HMR websocket +# reaches the public preview edge instead of localhost. +CMD ["sh", "-c", "HOST=\"${CODEPRESS_BIND_HOST:-0.0.0.0}\" WDS_SOCKET_PORT=\"${CODEPRESS_HMR_CLIENT_PORT:-443}\" yarn start"] diff --git a/.codepress/dev-server/recipe.json b/.codepress/dev-server/recipe.json new file mode 100644 index 0000000..afcde60 --- /dev/null +++ b/.codepress/dev-server/recipe.json @@ -0,0 +1,22 @@ +{ + "schema_version": 1, + "bootstrapped_at": "2026-07-18T03:20:00Z", + "discovery_branch": "master", + "frontends": [ + { + "label": "web", + "working_dir": "web", + "dockerfile_path": ".codepress/dev-server/Dockerfile.web", + "dev_command": "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": "medium" + } + ] +}