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:22-bookworm

# System packages the dev runtime needs. `procps` only: this Create React App has
# no source-built native modules, so no extra apt library is required — add one
# here only for a source-built native module (see the dockerfile contract).
RUN apt-get update \
&& apt-get install -y --no-install-recommends procps \
&& rm -rf /var/lib/apt/lists/*

# Enable corepack so the repo's yarn (classic, matching web/yarn.lock) resolves.
# No packageManager field is declared, so corepack's default yarn 1.x is used.
RUN corepack enable

WORKDIR /app

# 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). Only the toolchain lives here.

# HMR + bind config — values come from the runtime, never hardcoded.
# - HOST is CRA's bind var (alias of HOSTNAME); it must be 0.0.0.0 in-container.
# - WDS_SOCKET_PORT points CRA's webpack-dev-server HMR client at the PUBLIC edge
# port (usually 443 behind the wss proxy), not the in-container port.
# - DANGEROUSLY_DISABLE_HOST_CHECK lets the dev server accept the preview host
# header (the CRA analog of Vite's server.allowedHosts).
# - NODE_OPTIONS=--openssl-legacy-provider is required for react-scripts 1.0.10
# (webpack 3's md4 hashing) to boot on modern Node's OpenSSL 3.
# - BROWSER=none stops react-scripts from trying to open a browser in-container.
ENV HOSTNAME=0.0.0.0 \
CODEPRESS_BIND_HOST=0.0.0.0 \
HOST=0.0.0.0 \
PORT=3000 \
CODEPRESS_HMR_CLIENT_PORT=443 \
CODEPRESS_HMR_PROTOCOL=wss \
WDS_SOCKET_PORT=443 \
DANGEROUSLY_DISABLE_HOST_CHECK=true \
BROWSER=none \
NODE_OPTIONS=--openssl-legacy-provider

WORKDIR /app/web
EXPOSE 3000

# Put the app + root node_modules bins on PATH so a bare bin resolves at runtime
# (deps are hydrated on the bind-mounted checkout by the runtime). 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 via yarn. Map CRA's bind host and the
# HMR client socket port from the runtime env so the browser's HMR websocket
# reaches the public preview edge instead of localhost.
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-18T03:20:00Z",
"discovery_branch": "master",
"frontends": [
{
"label": "web",
"working_dir": "web",
"dockerfile_path": ".codepress/dev-server/Dockerfile.web",
"dev_command": "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"
}
]
}