Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .codepress/dev-server/Dockerfile.web
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# 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 is the OLDEST Node with an official -bookworm variant, and this app's
# toolchain is create-react-app 1.0.10 (webpack 2.6.1 / webpack-dev-server 2.5.0,
# 2017-era, engines.node ">=6"), so pin the most conservative supported base rather
# than the current LTS. Full -bookworm, never -slim: dependencies install at RUNTIME
# inside this image and node-gyp needs the make/gcc/g++/python3 toolchain -slim strips.
FROM public.ecr.aws/docker/library/node:18-bookworm

# System packages for the dev runtime. `procps` only: this app has no source-built
# native module. Its one native dependency, fsevents@1.1.2, is darwin-only and is
# skipped on Linux, and there is no node-sass/canvas in the lockfile, 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/*

# Bake ONLY the package-manager binary (never app deps) so a cold start never has to
# fetch yarn before the dev command can run. web/yarn.lock is a Yarn 1 lockfile and
# the repo declares no `packageManager` field, so pin Yarn 1.x explicitly.
RUN corepack enable && corepack prepare yarn@1.22.22 --activate

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

# Never try to launch a browser from a headless container. react-scripts honors
# BROWSER=none (react-dev-utils/openBrowser).
ENV BROWSER=none

# create-react-app disables webpack-dev-server's DNS-rebinding host check unless a
# `proxy` field is present in package.json (see react-scripts
# config/webpackDevServer.config.js: `disableHostCheck: !proxy || ...`). This repo
# sets no `proxy` today, so the check is already off — pin it explicitly so the
# per-session preview hostname keeps being accepted if a `proxy` is added later.
ENV DANGEROUSLY_DISABLE_HOST_CHECK=true

WORKDIR /app/web
EXPOSE 3000

# Put the app's node_modules/.bin on PATH as a backstop for anything invoking a bin
# directly; these dirs are populated at run time on the bind-mounted checkout.
# 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` reads HOST and PORT from the
# environment, so map the CodePress bind var onto CRA's HOST at RUNTIME — an
# `ENV HOST=$CODEPRESS_BIND_HOST` alias would freeze the build-time value and lose
# the runtime override.
#
# HMR: this CRA version's client (react-dev-utils 3.0.2 webpackHotDevClient) builds
# its sockjs URL from `window.location`, so behind the preview proxy it dials
# wss://<preview-host>/sockjs-node on 443 automatically — there is no client-port
# knob to set, and nothing hardcodes localhost. WDS_SOCKET_PORT is honored by
# react-scripts 3.4+ only; it is wired here for the uniform runtime contract and so
# that a react-scripts upgrade keeps working.
#
# Note for upgraders: webpack 2.6.1 defaults `output.hashFunction` to md5, so this
# image needs NO --openssl-legacy-provider. react-scripts >= 2 (webpack 4+) defaults
# to md4, which OpenSSL 3 (Node 17+) removed — if you upgrade react-scripts, add
# NODE_OPTIONS=--openssl-legacy-provider or set a modern `output.hashFunction`.
CMD ["sh", "-c", "HOST=\"${CODEPRESS_BIND_HOST:-0.0.0.0}\" WDS_SOCKET_PORT=\"${CODEPRESS_HMR_CLIENT_PORT:-443}\" yarn start"]
22 changes: 22 additions & 0 deletions .codepress/dev-server/recipe.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"schema_version": 1,
"bootstrapped_at": "2026-07-28T07:07:52Z",
"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": "medium"
}
]
}