From 4d81e1f8e61e28fe71fb65cd9f11dfb7e64ea345 Mon Sep 17 00:00:00 2001 From: gibbyb Date: Fri, 12 Sep 2025 17:21:38 -0500 Subject: [PATCH] Almost hostable from monorepo --- apps/next/tsconfig.json | 3 ++- host/next/docker/Dockerfile | 14 +++++++++----- host/next/docker/compose.yml | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/apps/next/tsconfig.json b/apps/next/tsconfig.json index 3e73a8e..3fa2e30 100644 --- a/apps/next/tsconfig.json +++ b/apps/next/tsconfig.json @@ -21,7 +21,8 @@ "plugins": [{ "name": "next" }], "baseUrl": ".", "paths": { - "@/*": ["./src/*"] + "@/*": ["./src/*"], + "~/*": ["../../packages/backend/*"] } }, "include": [ diff --git a/host/next/docker/Dockerfile b/host/next/docker/Dockerfile index 75be205..b108c45 100644 --- a/host/next/docker/Dockerfile +++ b/host/next/docker/Dockerfile @@ -10,6 +10,8 @@ WORKDIR /app # Copy package + whichever Bun lock file you have (optional) COPY package.json bun.lockb* bun.lock* ./ +COPY tsconfig.base.json ./ +COPY apps/next/package.json ./apps/next/ # If bun.lockb exists, enforce frozen; otherwise install and generate it RUN if [ -f bun.lockb ]; then \ @@ -22,7 +24,10 @@ RUN if [ -f bun.lockb ]; then \ FROM base AS builder WORKDIR /app COPY --from=deps /app/node_modules ./node_modules -COPY . . +COPY --from=deps /app/tsconfig.base.json ./tsconfig.base.json +COPY apps/next ./apps/next +COPY packages ./packages +WORKDIR /app/apps/next ENV NEXT_TELEMETRY_DISABLED=1 RUN bun run build @@ -34,13 +39,12 @@ ENV NEXT_TELEMETRY_DISABLED=1 # non-root user RUN addgroup -S nodejs -g 1001 && adduser -S nextjs -u 1001 -COPY --from=builder /app/public ./public -RUN mkdir .next && chown -R nextjs:nodejs .next +COPY --from=builder /app/apps/next/public ./public RUN mkdir -p .next/cache && chown -R nextjs:nodejs .next # Next standalone output -COPY --from=builder /app/.next/standalone ./ -COPY --from=builder /app/.next/static ./.next/static +COPY --from=builder /app/apps/next/.next/standalone ./ +COPY --from=builder /app/apps/next/.next/static ./.next/static USER nextjs EXPOSE 3000 diff --git a/host/next/docker/compose.yml b/host/next/docker/compose.yml index f3bcfd0..1addf6b 100644 --- a/host/next/docker/compose.yml +++ b/host/next/docker/compose.yml @@ -4,8 +4,8 @@ networks: services: techtracker-next: build: - context: ../../../apps/next/ - dockerfile: host/next/docker/Dockerfile + context: ../../../ + dockerfile: ./host/next/docker/Dockerfile image: ${CONTAINER_NAME}:alpine container_name: ${CONTAINER_NAME} env_file: [.env]