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
72 changes: 72 additions & 0 deletions .codepress/dev-server/Dockerfile.web
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# 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 Debian bookworm Node tag and the closest match for this
# app's 2017-era toolchain (react-scripts 1.0.10 -> webpack 2.6.1 /
# webpack-dev-server 2.5.0). webpack 2 hashes with md5, so OpenSSL 3 needs no
# legacy-provider flag here. The FULL -bookworm base (never -slim) ships the
# node-gyp toolchain the runtime dependency install may need.
FROM public.ecr.aws/docker/library/node:18-bookworm

# system_packages from recipe.json. `procps` only: this app's dependency tree has
# no source-built native modules (no node-sass / canvas / bcrypt; `fsevents` is
# darwin-only and is 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/*

# Bake only the package-manager binary. web/yarn.lock is a yarn-classic lockfile
# and package.json declares no `packageManager`, so pin yarn 1.x into the image
# and assert it resolves at build time — a cold start then never has to download
# a package manager before the dev server can boot. No app dependencies here.
RUN corepack enable \
&& corepack prepare yarn@1.22.22 --activate \
&& yarn --version

WORKDIR /app

# THIN image: no node_modules and no source COPY. The dev-server runtime
# bind-mounts the checkout at /app and provides dependencies at run time (either
# a pre-built node_modules squashfs overlay or `yarn install --frozen-lockfile`
# inside this image against the checkout).

# 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

# create-react-app dev-server settings:
# - HOST is CRA's bind var (mirrors CODEPRESS_BIND_HOST; the CMD re-reads it so a
# runtime override wins).
# - BROWSER=none: never try to launch a browser inside the container.
# - CI=false: keep dev warnings as warnings even if the platform injects CI=true.
# - DANGEROUSLY_DISABLE_HOST_CHECK=true: webpack-dev-server 2.5.0 rejects any
# request whose Host header it does not recognize ("Invalid Host header"), which
# would break every request served through the preview proxy's unique hostname.
# react-scripts 1.0.10 disables the check by default only while package.json has
# no `proxy` field, so set it explicitly — previews keep working if a `proxy` is
# added later.
ENV HOST=0.0.0.0 \
BROWSER=none \
CI=false \
DANGEROUSLY_DISABLE_HOST_CHECK=true

WORKDIR /app/web
EXPOSE 3000

# Put the app + root bins on PATH 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}, 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`, invoked through yarn so the
# package script resolves. CRA reads HOST and PORT from env. Its HMR client
# (react-dev-utils 3.0.2) derives the SockJS URL from window.location, so the
# websocket rides the public preview origin with no client-port config;
# WDS_SOCKET_PORT is still mapped for the uniform runtime contract and for any
# future react-scripts upgrade that honors it.
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-26T00:06:06Z",
"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"
}
]
}