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
62 changes: 62 additions & 0 deletions .codepress/dev-server/Dockerfile.web
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# 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 image and the closest match to this
# app's 2017-era toolchain (react-scripts 1.0.10 / webpack 2.6.1); newer majors
# drift further from what this dependency tree was built against. Verified: the
# app installs and serves on Node 18.20 / OpenSSL 3. Use the FULL -bookworm
# image, never -slim -- dependencies install at run time and need node-gyp's
# build toolchain.
FROM public.ecr.aws/docker/library/node:18-bookworm

# `procps` only: nothing in this dependency tree builds from source against a
# system library (its one native package, fsevents, is darwin-only and is
# skipped on linux). procps gives dev-process supervisors `ps` for clean
# shutdown in direct MicroVM runtimes.
RUN apt-get update \
&& apt-get install -y --no-install-recommends procps \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Package manager: yarn 1 (classic), which ships preinstalled in the node image
# and matches this repo's `yarn lockfile v1`. Corepack is deliberately NOT
# enabled: the repo declares no `packageManager`, so a corepack shim would try
# to fetch a yarn release from the network on first run and can fail a cold
# start for no benefit.

# THIN image: no node_modules, no source COPY. The dev-server runtime provides
# dependencies at run time (squashfs hydration, or `yarn install` in this image
# against the bind-mounted 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

# Never try to open a browser inside the container.
ENV BROWSER=none

# webpack-dev-server 2.5.0 answers unknown Host headers with "Invalid Host
# header". react-scripts skips that check only while no `proxy` is configured
# in web/package.json -- true today, but set the flag explicitly so a preview
# served from an arbitrary *.preview.codepress.dev host keeps working if a
# `proxy` is ever added.
ENV DANGEROUSLY_DISABLE_HOST_CHECK=true

WORKDIR /app/web
EXPOSE 3000

# Backstop so the dev command resolves node_modules/.bin even when a bin is
# invoked directly. Populated at run time on the bind-mounted checkout.
ENV PATH="/app/web/node_modules/.bin:/app/node_modules/.bin:${PATH}"

# Dev command (HMR on). react-scripts 1.0.10 reads HOST and PORT from env.
# HMR needs no client-port flag here: react-dev-utils 3.0.2's hot client builds
# its SockJS URL from window.location, so it follows the preview origin (wss on
# 443) by itself. WDS_SOCKET_PORT is inert on this pinned version and only takes
# effect if react-scripts is ever upgraded to >= 3.4.
CMD ["sh", "-c", "HOST=\"$CODEPRESS_BIND_HOST\" WDS_SOCKET_PORT=\"$CODEPRESS_HMR_CLIENT_PORT\" 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-28T05:10:23Z",
"discovery_branch": "master",
"frontends": [
{
"label": "web",
"working_dir": "web",
"dockerfile_path": ".codepress/dev-server/Dockerfile.web",
"dev_command": "sh -c 'HOST=\"$CODEPRESS_BIND_HOST\" WDS_SOCKET_PORT=\"$CODEPRESS_HMR_CLIENT_PORT\" 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"
}
]
}