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
65 changes: 65 additions & 0 deletions .codepress/dev-server/Dockerfile.web
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# 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 16 is deliberate, not stale. web/ runs Create React App 1.0.10 on webpack
# 2.6.1, which hashes modules with md4. On Node 17+ (OpenSSL 3) that throws
# "error:0308010C:digital envelope routines::unsupported" and the dev server never
# starts. Node 16 ships OpenSSL 1.1.1, so the 2017 toolchain pinned in
# web/yarn.lock compiles and hot-reloads unmodified.
# Full -bookworm, never -slim: dependencies are installed at run time, and any
# node-gyp build needs the make/gcc/g++/python3 toolchain the full base carries.
FROM public.ecr.aws/docker/library/node:16-bookworm

# System packages beyond the base toolchain. `procps` is the baseline so dev
# process supervisors can inspect and clean up child processes during SIGTERM
# shutdown; this app's lockfile has no source-built native module that links
# against an extra system library.
RUN apt-get update \
&& apt-get install -y --no-install-recommends procps \
&& rm -rf /var/lib/apt/lists/*

# Package manager: yarn 1 (classic) — the format web/yarn.lock is written in, and
# already bundled in the Node base image. No corepack shim is activated on
# purpose: the repo declares no `packageManager`, and an unpinned shim would try
# to fetch yarn from the public registry on every cold start.

WORKDIR /app

# THIN image: no baked node_modules, no source COPY. The dev-server runtime
# bind-mounts the checkout at /app and provides dependencies there (squashfs
# hydration, or `yarn install --frozen-lockfile` run in this image against the
# checkout). Only the toolchain lives in the image.

# HMR + bind config — values come from the runtime, never hardcoded.
# HOST is CRA's spelling of the bind address (react-scripts reads process.env.HOST).
# BROWSER=none stops react-scripts from trying to launch a browser in the container.
# DANGEROUSLY_DISABLE_HOST_CHECK keeps webpack-dev-server 2.x from rejecting the
# preview hostname with "Invalid Host header". CRA already disables that check
# while web/package.json declares no `proxy` field; setting it explicitly keeps
# the preview working if a `proxy` is added later. The dev server is only
# reachable through the CodePress preview proxy, never published directly.
ENV HOSTNAME=0.0.0.0 \
HOST=0.0.0.0 \
CODEPRESS_BIND_HOST=0.0.0.0 \
PORT=3000 \
CODEPRESS_HMR_CLIENT_PORT=443 \
CODEPRESS_HMR_PROTOCOL=wss \
CODEPRESS_BASE_PATH=/ \
BROWSER=none \
DANGEROUSLY_DISABLE_HOST_CHECK=true

WORKDIR /app/web
EXPOSE 3000

# Put the checkout's bins on PATH so anything the dev command shells out to can
# resolve 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) — must stay identical to `dev_command` in recipe.json.
# Routed through yarn rather than invoking react-scripts bare. CRA 1.x derives
# its HMR websocket URL from window.location, so it follows the public preview
# origin automatically; WDS_SOCKET_PORT is mapped from the runtime's public HMR
# port so the wiring stays correct if react-scripts is ever upgraded.
CMD ["sh", "-c", "BROWSER=none 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-27T05:06:36Z",
"discovery_branch": "master",
"frontends": [
{
"label": "web",
"working_dir": "web",
"dockerfile_path": ".codepress/dev-server/Dockerfile.web",
"dev_command": "sh -c 'BROWSER=none 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"
}
]
}