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
54 changes: 54 additions & 0 deletions .codepress/dev-server/Dockerfile.web
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 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.
FROM public.ecr.aws/docker/library/node:18-bookworm

# Node 18 rather than the current LTS on purpose: web/ is Create React App
# (react-scripts 1.0.10) pinned to webpack 2.6.1 / webpack-dev-server 2.5.0 in
# web/yarn.lock, which does not run reliably on recent Node majors.

# System packages the dev runtime needs. `procps` only: the one native dependency
# in web/yarn.lock is `fsevents` (macOS-only, skipped on Linux), so nothing is
# built from source here.
RUN apt-get update \
&& apt-get install -y --no-install-recommends procps \
&& rm -rf /var/lib/apt/lists/*

# Bake only the package-manager binary (no app dependencies) so a cold start
# never has to fetch yarn from the registry before the dev server can boot.
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

# CRA dev-server behaviour inside a container: never try to launch a browser, and
# accept the preview proxy's Host header.
ENV BROWSER=none \
DANGEROUSLY_DISABLE_HOST_CHECK=true

WORKDIR /app/web
EXPOSE 3000

# Put the checkout's 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}, so the
# corepack/yarn shims survive.
ENV PATH="/app/web/node_modules/.bin:/app/node_modules/.bin:${PATH}"

# Dev command (HMR on), invoked through the package manager rather than a bare
# binary. react-scripts reads HOST and PORT from env. This CRA version derives
# its HMR socket URL from window.location, so the websocket follows the public
# preview origin automatically once upgrades are proxied; WDS_SOCKET_PORT /
# WDS_SOCKET_PROTOCOL are exported for the same contract and are ignored by 1.x.
CMD ["sh", "-c", "HOST=\"${CODEPRESS_BIND_HOST:-0.0.0.0}\" WDS_SOCKET_PORT=\"${CODEPRESS_HMR_CLIENT_PORT:-443}\" WDS_SOCKET_PROTOCOL=\"${CODEPRESS_HMR_PROTOCOL:-wss}\" 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-25T09:11:00Z",
"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}\" WDS_SOCKET_PROTOCOL=\"${CODEPRESS_HMR_PROTOCOL:-wss}\" 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"
}
]
}