Skip to content
Merged
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
17 changes: 17 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.git
.githooks
.github
.DS_Store
.env
.env.*
node_modules
.pnpm-store
.npm-cache
lib
storybook-static
coverage
test-results
playwright-report
*.log
AGENTS.md
CONTINUITY.md
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ debug-storybook.log
*storybook.log
storybook-static
coverage
AGENTS.md
CONTINUITY.md
64 changes: 64 additions & 0 deletions Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
admin off
persist_config off
auto_https off

servers {
trusted_proxies static private_ranges 100.0.0.0/8
trusted_proxies_strict
}
}

:{$PORT:3000} {
log {
format json
}

header {
Content-Security-Policy "frame-ancestors 'self';"
Referrer-Policy "strict-origin-when-cross-origin"
Strict-Transport-Security "max-age=63072000; includeSubDomains"
X-Content-Type-Options "nosniff"
X-Frame-Options "SAMEORIGIN"
-Server
}

@health {
method GET HEAD
path /health
}
handle @health {
header {
Cache-Control "no-store"
Content-Type "text/plain; charset=utf-8"
}
respond "ok" 200
}

@unsupportedMethod not method GET HEAD
handle @unsupportedMethod {
header Cache-Control "no-store"
respond "Not found" 404
}

handle {
route {
root * /srv
encode zstd gzip

header Cache-Control "public, max-age=0, s-maxage=60, stale-while-revalidate=300"

@immutable path /assets/*
header @immutable Cache-Control "public, max-age=31536000, immutable"

@root path /
rewrite @root /index.html

@notFound not file
header @notFound Cache-Control "no-store"
respond @notFound "Not found" 404

file_server
}
}
}
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM node:22-alpine AS build

WORKDIR /workspace

RUN corepack enable && corepack prepare pnpm@11.1.2 --activate

COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY scripts/setup-git-hooks.mjs ./scripts/setup-git-hooks.mjs

RUN pnpm install --frozen-lockfile

COPY . .

RUN pnpm build:sb

FROM caddy:2-alpine AS runtime

WORKDIR /srv

COPY Caddyfile /etc/caddy/Caddyfile
COPY --from=build /workspace/storybook-static /srv

CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"lint": "oxlint . --ignore-pattern node_modules --ignore-pattern lib",
"prepare": "node scripts/setup-git-hooks.mjs",
"preview:sb": "pnpm build:sb && npx serve -s storybook-static -l 3000",
"start:storybook": "node scripts/serve-storybook.mjs",
"precommit:checks": "pnpm format:check && pnpm lint && pnpm test",
"test": "pnpm test:all",
"test:all": "pnpm test:unit && pnpm test:storybook",
Expand Down
6 changes: 3 additions & 3 deletions railway.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[build]
builder = "RAILPACK"
buildCommand = "pnpm build:sb"
builder = "DOCKERFILE"
dockerfilePath = "Dockerfile"

[deploy]
startCommand = "pnpm start:storybook"
healthcheckPath = "/health"
healthcheckTimeout = 60
restartPolicyType = "ON_FAILURE"
restartPolicyMaxRetries = 10
59 changes: 0 additions & 59 deletions scripts/serve-storybook.mjs

This file was deleted.

Loading