Skip to content
Draft
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
32 changes: 32 additions & 0 deletions .codepress/dev-server/Dockerfile.web
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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

# The runtime may install native dependencies against the bind-mounted checkout.
RUN apt-get update \
&& apt-get install -y --no-install-recommends procps \
&& rm -rf /var/lib/apt/lists/*

# Keep the repository's exact package-manager version available in the image.
RUN corepack enable \
&& npm install --global npm@11.8.0

WORKDIR /app

# THIN image: no node_modules, manifests, or source are copied here. The Live
# Dev Server runtime provides dependencies and the checked-out source at /app.

# Runtime-provided bind and HMR settings. Vite reads these in vite.config.ts.
ENV HOSTNAME=0.0.0.0 \
CODEPRESS_BIND_HOST=0.0.0.0 \
PORT=5173 \
CODEPRESS_HMR_CLIENT_PORT=443 \
CODEPRESS_HMR_PROTOCOL=wss

EXPOSE 5173

# Keep the local package binary available when the runtime hydrates dependencies.
ENV PATH="/app/node_modules/.bin:${PATH}"

CMD ["npm", "run", "dev"]
23 changes: 23 additions & 0 deletions .codepress/dev-server/recipe.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"schema_version": 1,
"bootstrapped_at": "2026-08-20T00:32:15Z",
"discovery_branch": "codepress/bootstrap/dev-server/723bb63eb27b4e2a",
"frontends": [
{
"label": "web",
"working_dir": "",
"description": "FreeCut browser-based multi-track video editor",
"dockerfile_path": ".codepress/dev-server/Dockerfile.web",
"dev_command": "npm run dev",
"prebuild_command": "",
"prebuild_inputs": [],
"framework": "vite",
"package_manager": "npm",
"install_command": "npm install",
"dependency_manifests": ["package-lock.json"],
"dev_port": 5173,
"system_packages": ["procps"],
"size": "large"
}
]
}
19 changes: 18 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,19 @@ const toolIgnorePatterns = [
'scripts/**',
]

// CodePress Live Dev Server managed: keep preview bind, base-path, and HMR
// settings configurable without changing the production defaults.
const codePressBindHost = process.env.CODEPRESS_BIND_HOST ?? '0.0.0.0'
const codePressPort = Number(process.env.PORT ?? 5173)
const codePressBasePath = process.env.CODEPRESS_BASE_PATH
? `${process.env.CODEPRESS_BASE_PATH.replace(/\/+$/, '')}/`
: '/'
const codePressHmrClientPort = Number(process.env.CODEPRESS_HMR_CLIENT_PORT ?? 443)
const codePressHmrProtocol = process.env.CODEPRESS_HMR_PROTOCOL === 'ws' ? 'ws' : 'wss'

// https://vite.dev/config/
export default defineConfig({
base: codePressBasePath,
lint: {
...oxlintConfig,
ignorePatterns: toolIgnorePatterns,
Expand Down Expand Up @@ -104,8 +115,14 @@ export default defineConfig({
dedupe: ['react', 'react-dom'],
},
server: {
port: 5173,
host: codePressBindHost,
port: codePressPort,
strictPort: true,
allowedHosts: true,
hmr: {
clientPort: codePressHmrClientPort,
protocol: codePressHmrProtocol,
},
headers: {
'Cross-Origin-Embedder-Policy': 'require-corp',
'Cross-Origin-Opener-Policy': 'same-origin',
Expand Down
Loading