From 83efa5b0512ee44d9c90e60fc0ca897990053078 Mon Sep 17 00:00:00 2001 From: vince Date: Fri, 19 Jun 2026 13:13:20 +0200 Subject: [PATCH] build: add internal container deployment --- .containerignore | 12 ++++++++++++ Containerfile | 30 ++++++++++++++++++++++++++++++ README.md | 20 ++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 .containerignore create mode 100644 Containerfile diff --git a/.containerignore b/.containerignore new file mode 100644 index 0000000..70b617e --- /dev/null +++ b/.containerignore @@ -0,0 +1,12 @@ +.git +.svelte-kit +build +coverage +data +dist +node_modules +playwright-report +storybook-static +test-results +.env +.env.* diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..9a7c7c6 --- /dev/null +++ b/Containerfile @@ -0,0 +1,30 @@ +FROM docker.io/oven/bun:1.3.14 AS deps + +WORKDIR /app +COPY package.json bun.lock ./ +RUN bun install --frozen-lockfile + +FROM deps AS build + +COPY . . +RUN bun run build + +FROM docker.io/oven/bun:1.3.14 AS runtime + +WORKDIR /app +ENV NODE_ENV=production +ENV HOST=0.0.0.0 +ENV PORT=3000 +ENV DATABASE_URL=file:/data/dimensionlab.sqlite +ENV DASHBOARD_MIGRATIONS_DIR=/app/drizzle + +COPY package.json bun.lock ./ +RUN bun install --frozen-lockfile --production +COPY --from=build /app/build ./build +COPY --from=build /app/drizzle ./drizzle + +RUN mkdir -p /data +VOLUME ["/data"] +EXPOSE 3000 + +CMD ["bun", "build/index.js"] diff --git a/README.md b/README.md index 7faed62..7e4b25a 100644 --- a/README.md +++ b/README.md @@ -116,3 +116,23 @@ DATABASE_URL=file:/data/dimensionlab.sqlite HOST=0.0.0.0 PORT=3000 bun build/ind Mount `/data` or set `DATABASE_URL` to another persistent SQLite path. If the process starts outside the repository root, set `DASHBOARD_MIGRATIONS_DIR` to the checked-in `drizzle/` directory so startup migrations can run. + +### Internal Container + +The checked-in `Containerfile` builds the SvelteKit adapter output into a Bun +runtime image. For the Dimension Lab internal host, run it behind Caddy on a +loopback port and mount persistent state at `/data`: + +```sh +podman build -t localhost/dimensionlab-website:latest . +podman run --rm \ + --publish 127.0.0.1:25341:3000 \ + --volume "$HOME/containers/dimensionlab-website/data:/data:Z" \ + --env-file "$HOME/containers/dimensionlab-website/dimensionlab-website.env" \ + localhost/dimensionlab-website:latest +``` + +The env file must provide `AGENT_CONFIG_TOKEN`. Runtime defaults inside the +image set `HOST=0.0.0.0`, `PORT=3000`, +`DATABASE_URL=file:/data/dimensionlab.sqlite`, and +`DASHBOARD_MIGRATIONS_DIR=/app/drizzle`. -- 2.49.1