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
63 changes: 63 additions & 0 deletions .codepress/dev-server/Dockerfile.web
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 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 bookworm-based Node image and the closest match to this
# app's 2017-era toolchain (react-scripts 1.0.10 on webpack 2.6.1). The FULL
# -bookworm variant (never -slim) ships the node-gyp toolchain that the runtime
# dependency install needs. Pulled from AWS's public-ECR mirror of Docker Hub's
# official images so concurrent dev-image builds aren't rate limited on FROM.
FROM public.ecr.aws/docker/library/node:18-bookworm

# System packages the dev runtime needs. `procps` only: this app builds no native
# module from source (its one native dependency, fsevents, is darwin-only and
# optional, so it is skipped on linux), and `ps` is what dev-process supervisors
# shell out to during clean shutdown in direct MicroVM runtimes.
RUN apt-get update \
&& apt-get install -y --no-install-recommends procps \
&& rm -rf /var/lib/apt/lists/*

# Bake the exact yarn-classic version matching the repo's `yarn lockfile v1`, so a
# cold start never has to download a package manager before the dev command runs.
RUN corepack enable && corepack prepare yarn@1.22.22 --activate

WORKDIR /app

# THIN image: no `node_modules` and 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 at /app). Only the toolchain
# lives here, and no CodePress binary is baked in — this is the repo's own image.

# HMR + bind config. Defaults only: the runtime injects the real values, so nothing
# here may hardcode localhost or a public port.
ENV HOSTNAME=0.0.0.0 \
CODEPRESS_BIND_HOST=0.0.0.0 \
PORT=3000 \
CODEPRESS_HMR_CLIENT_PORT=443 \
CODEPRESS_HMR_PROTOCOL=wss

# Container-specific dev-server behaviour:
# - BROWSER=none stops `react-scripts start` from trying to open a browser.
# - DANGEROUSLY_DISABLE_HOST_CHECK lets webpack-dev-server accept the preview
# proxy's Host header — the CRA equivalent of Vite's `server.allowedHosts`.
# Dev-image only; it never takes part in a production build.
ENV BROWSER=none \
DANGEROUSLY_DISABLE_HOST_CHECK=true

WORKDIR /app/web
EXPOSE 3000

# Put the app's and the repo root's node_modules/.bin on PATH so any binary the dev
# command shells out to resolves. Both dirs are populated at run time on the
# bind-mounted checkout. Prepend — never replace ${PATH} — so the corepack shims
# survive.
ENV PATH="/app/web/node_modules/.bin:/app/node_modules/.bin:${PATH}"

# Dev command (HMR on) — never a production build (`react-scripts build`).
# react-scripts reads HOST and PORT from the environment, so the in-container bind
# comes from CODEPRESS_BIND_HOST. This app's react-dev-utils HMR client derives its
# websocket URL from the page origin (window.location), so HMR rides the preview
# origin behind the proxy; WDS_SOCKET_PORT is mapped from CODEPRESS_HMR_CLIENT_PORT
# so the wiring is already correct if react-scripts is later upgraded to a version
# 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-25T19:31:10Z",
"discovery_branch": "codepress/dev@codepress.dev/bootstrap-live-dev-server-artifacts-f7760c91",
"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}\" BROWSER=none DANGEROUSLY_DISABLE_HOST_CHECK=true 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"
}
]
}