From af21a35f0584c9df8012350ddf5eb13fdc05d87a Mon Sep 17 00:00:00 2001 From: killer-cf Date: Thu, 27 Nov 2025 12:01:36 -0300 Subject: [PATCH] feat: Add `@convex-dev/better-auth` dependency and refactor Dockerfile to support monorepo workspace builds, updating Turbo build output path. --- apps/web/Dockerfile | 22 ++++++++++++++-------- apps/web/vite.config.ts | 10 +++++----- bun.lock | 1 + package.json | 5 +++-- turbo.json | 2 +- 5 files changed, 24 insertions(+), 16 deletions(-) diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile index d1e1a43..71f9ef7 100644 --- a/apps/web/Dockerfile +++ b/apps/web/Dockerfile @@ -32,25 +32,31 @@ RUN bunx turbo build # Production stage FROM oven/bun:1-slim AS production -# Set working directory +# Set working directory to match builder structure WORKDIR /app # Create non-root user RUN addgroup --system --gid 1001 sveltekit RUN adduser --system --uid 1001 sveltekit -# Copy built application from base stage -COPY --from=builder --chown=sveltekit:sveltekit /app/apps/web/build ./build -COPY --from=builder --chown=sveltekit:sveltekit /app/apps/web/package.json ./package.json -# Copy node_modules from root (Bun manages workspaces centrally) -COPY --from=builder --chown=sveltekit:sveltekit /app/apps/web/node_modules ./node_modules +# Copy root node_modules (contains hoisted dependencies) +COPY --from=builder --chown=sveltekit:sveltekit /app/node_modules ./node_modules + +# Copy built application and workspace files +COPY --from=builder --chown=sveltekit:sveltekit /app/apps/web/build ./apps/web/build +COPY --from=builder --chown=sveltekit:sveltekit /app/apps/web/package.json ./apps/web/package.json +# Copy workspace node_modules (contains symlinks to root node_modules) +COPY --from=builder --chown=sveltekit:sveltekit /app/apps/web/node_modules ./apps/web/node_modules # Copy any additional files needed for runtime -COPY --from=builder --chown=sveltekit:sveltekit /app/apps/web/static ./static +COPY --from=builder --chown=sveltekit:sveltekit /app/apps/web/static ./apps/web/static # Switch to non-root user USER sveltekit +# Set working directory to the app +WORKDIR /app/apps/web + # Expose the port that the app runs on EXPOSE 5173 @@ -60,7 +66,7 @@ ENV PORT=5173 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ - CMD bun --version || exit 1 + CMD bun --version || exit 1 # Start the application CMD ["bun", "./build/index.js"] diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts index e43a543..d3107e2 100644 --- a/apps/web/vite.config.ts +++ b/apps/web/vite.config.ts @@ -1,10 +1,10 @@ -import tailwindcss from "@tailwindcss/vite"; -import { sveltekit } from "@sveltejs/kit/vite"; -import { defineConfig } from "vite"; +import tailwindcss from '@tailwindcss/vite'; +import { sveltekit } from '@sveltejs/kit/vite'; +import { defineConfig } from 'vite'; export default defineConfig({ plugins: [tailwindcss(), sveltekit()], resolve: { - dedupe: ["lucide-svelte"], - }, + dedupe: ['lucide-svelte'] + } }); diff --git a/bun.lock b/bun.lock index cb8737c..56bacb1 100644 --- a/bun.lock +++ b/bun.lock @@ -5,6 +5,7 @@ "": { "name": "sgse-app", "dependencies": { + "@convex-dev/better-auth": "^0.9.7", "@tanstack/svelte-form": "^1.23.8", "chart.js": "^4.5.1", "lucide-svelte": "^0.552.0", diff --git a/package.json b/package.json index 6748b71..4d32314 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "lucide-svelte": "^0.552.0", "prettier-plugin-svelte": "^3.4.0", "svelte-chartjs": "^3.1.5", - "svelte-sonner": "^1.0.5" + "svelte-sonner": "^1.0.5", + "@convex-dev/better-auth": "^0.9.7" }, "packageManager": "bun@1.3.0" -} \ No newline at end of file +} diff --git a/turbo.json b/turbo.json index eadc42f..514423c 100644 --- a/turbo.json +++ b/turbo.json @@ -5,7 +5,7 @@ "build": { "dependsOn": ["^build"], "inputs": ["$TURBO_DEFAULT$", ".env*"], - "outputs": ["dist/**"] + "outputs": ["build/**"] }, "lint": { "dependsOn": ["^lint"]