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
59 changes: 59 additions & 0 deletions .codepress/dev-server/Dockerfile.web
Original file line number Diff line number Diff line change
@@ -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"]
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-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"
}
]
}