From eabebfd7611eccc19d7a336dc97c9b8d2845c1d7 Mon Sep 17 00:00:00 2001 From: Luciano Castillo <2213102+luccast@users.noreply.github.com> Date: Wed, 28 Jan 2026 12:21:06 -0500 Subject: [PATCH] support ALLOWED_HOSTS env var, fix Dockerfile missing source files (#12) - parse ALLOWED_HOSTS into vite server.allowedHosts for LAN/tailscale access - copy src/, public/, vite.config.ts, tsconfig.json into Docker runtime stage (dev server needs these, only dist/ was copied before) - pass ALLOWED_HOSTS through docker-compose Ref #10 --- .env.example | 4 ++++ Dockerfile | 4 ++++ docker-compose.yml | 1 + vite.config.ts | 7 +++++++ 4 files changed, 16 insertions(+) diff --git a/.env.example b/.env.example index 727dfd2..bbd86bb 100644 --- a/.env.example +++ b/.env.example @@ -3,3 +3,7 @@ # Clawdbot gateway auth token CLAWDBOT_API_TOKEN= + +# Comma-separated list of allowed hosts for the dev server +# Example: ALLOWED_HOSTS=myhost.local,192.168.1.100,.mydomain.com +ALLOWED_HOSTS= diff --git a/Dockerfile b/Dockerfile index ec08973..8f17acc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,6 +24,10 @@ COPY package*.json ./ RUN npm ci COPY --from=builder /app/dist ./dist +COPY --from=builder /app/src ./src +COPY --from=builder /app/public ./public +COPY --from=builder /app/vite.config.ts ./ +COPY --from=builder /app/tsconfig.json ./ EXPOSE 3000 diff --git a/docker-compose.yml b/docker-compose.yml index 4160f58..92bb6fc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,4 +5,5 @@ services: - "3000:3000" environment: - CLAWDBOT_API_TOKEN=${CLAWDBOT_API_TOKEN} + - ALLOWED_HOSTS=${ALLOWED_HOSTS:-} restart: unless-stopped diff --git a/vite.config.ts b/vite.config.ts index 53d441c..25bbc3a 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,7 +4,14 @@ import viteReact from '@vitejs/plugin-react' import viteTsConfigPaths from 'vite-tsconfig-paths' import tailwindcss from '@tailwindcss/vite' +const allowedHosts = process.env.ALLOWED_HOSTS + ? process.env.ALLOWED_HOSTS.split(',').map(host => host.trim()).filter(Boolean) + : undefined + export default defineConfig({ + server: { + allowedHosts, + }, plugins: [ viteTsConfigPaths({ projects: ['./tsconfig.json'],