diff --git a/.codepress/dev-server/Dockerfile.web b/.codepress/dev-server/Dockerfile.web new file mode 100644 index 0000000..720dd05 --- /dev/null +++ b/.codepress/dev-server/Dockerfile.web @@ -0,0 +1,66 @@ +# 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 rather than the current LTS is deliberate. This app is Create React App +# 1.0.10 (webpack 2.6, React 15, babel 6), a 2017 toolchain that does not run on +# modern Node. 18 is the oldest bookworm-based official Node image, so it stays on +# a maintained base OS while giving the old toolchain the best chance of running, +# and it still ships the Yarn 1 binary this repo's lockfile needs. +FROM public.ecr.aws/docker/library/node:18-bookworm + +# System packages the dev runtime needs. `procps` only: nothing in web/yarn.lock +# builds a native module from source (fsevents is darwin-gated 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/* + +# Package manager: Yarn 1 (web/yarn.lock). The base image already ships it, and the +# repo declares no `packageManager` field, so corepack is intentionally left off — +# enabling it without a pinned version makes the container fetch a package manager +# from the public registry on cold start, before the dev command can run. Fail the +# build loudly if the base image ever stops bundling yarn. +RUN yarn --version + +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. +ENV HOSTNAME=0.0.0.0 \ + CODEPRESS_BIND_HOST=0.0.0.0 \ + PORT=3000 \ + CODEPRESS_HMR_CLIENT_PORT=443 \ + CODEPRESS_HMR_PROTOCOL=wss + +# webpack 2 hashes modules with md4, which OpenSSL 3 (bundled with every bookworm +# Node) dropped from its default provider. Without this flag `react-scripts start` +# aborts immediately with +# `error:0308010C:digital envelope routines::unsupported`. +ENV NODE_OPTIONS=--openssl-legacy-provider + +# BROWSER=none stops CRA trying to open a browser inside the container. +# DANGEROUSLY_DISABLE_HOST_CHECK makes webpack-dev-server 2.x accept the preview +# hostname instead of answering "Invalid Host header" — the CRA equivalent of +# Vite's `allowedHosts`, needed because the preview is served from +# .preview.codepress.dev rather than localhost. It is scoped to this +# dev-preview image and never affects a production build. +ENV BROWSER=none \ + DANGEROUSLY_DISABLE_HOST_CHECK=true + +WORKDIR /app/web +EXPOSE 3000 + +# Put the app's bins on PATH so the dev command — and anything it shells out to — +# resolves node_modules/.bin. These dirs are populated at run time on the +# bind-mounted checkout (hydration / runtime install). +ENV PATH="/app/web/node_modules/.bin:/app/node_modules/.bin:${PATH}" + +# Dev command (HMR on). CRA reads PORT directly; HOST is its bind variable, mapped +# from CODEPRESS_BIND_HOST. WDS_SOCKET_PORT is forwarded for the uniform runtime +# contract — react-dev-utils 3.x derives its HMR socket URL from window.location, +# so the hot-reload websocket already rides the public preview origin. +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..ce61b5d --- /dev/null +++ b/.codepress/dev-server/recipe.json @@ -0,0 +1,22 @@ +{ + "schema_version": 1, + "bootstrapped_at": "2026-07-27T06:30:17Z", + "discovery_branch": "master", + "frontends": [ + { + "label": "web", + "working_dir": "web", + "dockerfile_path": ".codepress/dev-server/Dockerfile.web", + "dev_command": "sh -c 'HOST=\"${CODEPRESS_BIND_HOST:-0.0.0.0}\" WDS_SOCKET_PORT=\"${CODEPRESS_HMR_CLIENT_PORT:-443}\" 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" + } + ] +}