diff --git a/docker/.dockerignore b/docker/.dockerignore index b5b7a86..cb3123f 100644 --- a/docker/.dockerignore +++ b/docker/.dockerignore @@ -1,19 +1,18 @@ -# Dependencies -node_modules -bun.lockb -*.lock +# Dependencies - exclude node_modules from being copied +**/node_modules -# Next.js -apps/next/.next -apps/next/out -apps/next/.turbo +# Turbo +**/.turbo + +# Next.js build artifacts +**/.next +**/out # Development .git .gitignore *.log -*.md -README.md +.env.local .env*.local .vscode .idea @@ -25,13 +24,11 @@ README.md **/*.spec.ts # Build artifacts -dist -build -.turbo +**/dist +**/build # Convex local packages/backend/.convex -convex/_generated # OS .DS_Store diff --git a/docker/Dockerfile b/docker/Dockerfile index efa1f44..a24ece2 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,34 +1,18 @@ # syntax=docker/dockerfile:1 FROM oven/bun:alpine AS base -# Install dependencies only when needed -FROM base AS deps +# Builder stage - do everything here +FROM base AS builder RUN apk add --no-cache libc6-compat WORKDIR /app -# Copy root package files -COPY package.json turbo.json ./ -COPY bun.lockb* ./ -COPY apps/next/package.json ./apps/next/package.json -COPY packages/backend/package.json ./packages/backend/package.json -COPY tools/*/package.json ./tools/ - -# Install dependencies -RUN bun install --frozen-lockfile - -# Builder stage -FROM base AS builder -WORKDIR /app - -# Copy dependencies -COPY --from=deps /app/node_modules ./node_modules -COPY --from=deps /app/apps/next/node_modules ./apps/next/node_modules -COPY --from=deps /app/packages/backend/node_modules ./packages/backend/node_modules - -# Copy source code +# Copy all source code first COPY . . -# Build +# Install dependencies (this will create proper workspace structure) +RUN bun install + +# Build the Next.js app ENV NEXT_TELEMETRY_DISABLED=1 ENV SKIP_ENV_VALIDATION=1 RUN bun run build --filter=@gib/next @@ -49,9 +33,7 @@ COPY --from=builder --chown=nextjs:nodejs /app/apps/next/.next/static ./apps/nex COPY --from=builder --chown=nextjs:nodejs /app/apps/next/public ./apps/next/public USER nextjs - EXPOSE 3000 - ENV PORT=3000 ENV HOSTNAME="0.0.0.0"