Skip to content

Commit c685963

Browse files
committed
Merge branch 'main' of https://github.com/trycompai/comp into mariano/fix-policies
2 parents fd74000 + 1b351db commit c685963

File tree

72 files changed

+1588
-1219
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1588
-1219
lines changed

.env.example

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
# Database Configuration
1+
# Database Configuration - Required
22
DATABASE_URL="postgresql://postgres:[email protected]:5432/comp"
33

4-
# Authentication
4+
# Authentication - Required
55
AUTH_SECRET=your-secret-auth-key-here-min-32-chars
6+
7+
# Optional
68
AUTH_GOOGLE_ID=your-google-oauth-client-id
79
AUTH_GOOGLE_SECRET=your-google-oauth-client-secret
810
AUTH_GITHUB_ID=your-github-oauth-app-id
911
AUTH_GITHUB_SECRET=your-github-oauth-app-secret
1012

11-
# Email Service
13+
# Email Service - Required for OTP and Magic Link
1214
RESEND_API_KEY=re_your_resend_api_key_here
1315

1416
# Application URLs
@@ -18,7 +20,7 @@ NEXT_PUBLIC_VERCEL_URL=http://localhost:3000
1820
# Security
1921
REVALIDATION_SECRET=your-revalidation-secret-here
2022

21-
# Optional - Redis/Upstash (for caching)
23+
# Required - Redis/Upstash (for caching)
2224
UPSTASH_REDIS_REST_URL=your-upstash-redis-url
2325
UPSTASH_REDIS_REST_TOKEN=your-upstash-redis-token
2426

@@ -28,16 +30,18 @@ APP_AWS_SECRET_ACCESS_KEY=your-aws-secret-key
2830
APP_AWS_REGION=us-east-1
2931
APP_AWS_BUCKET_NAME=your-s3-bucket-name
3032

31-
# Optional - OpenAI
33+
# Optional - for AI features
3234
OPENAI_API_KEY=sk-your-openai-api-key
3335

3436
# Optional - Analytics
3537
NEXT_PUBLIC_POSTHOG_KEY=your-posthog-key
3638
NEXT_PUBLIC_POSTHOG_HOST=https://app.posthog.com
3739

38-
# Optional - External Services
40+
# Required - External Services
3941
TRIGGER_SECRET_KEY=your-trigger-secret
4042
TRIGGER_API_KEY=your-trigger-api-key
43+
44+
# Required - Chat and research with AI
4145
GROQ_API_KEY=your-groq-api-key
4246
FIRECRAWL_API_KEY=your-firecrawl-key
4347

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ A visual demonstration is strongly recommended, for both the original and new ch
3838

3939
<!-- Remove bullet points below that don't apply to you -->
4040

41-
- I haven't read the [contributing guide](https://github.com/trycomp/comp/blob/main/CONTRIBUTING.md)
41+
- I haven't read the [contributing guide](https://github.com/trycompai/comp/blob/main/CONTRIBUTING.md)
4242
- My code doesn't follow the style guidelines of this project
4343
- I haven't commented my code, particularly in hard-to-understand areas
4444
- I haven't checked if my changes generate no new warnings

Dockerfile

Lines changed: 59 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ WORKDIR /app
88
# Copy workspace configuration
99
COPY package.json bun.lock ./
1010

11-
# Copy package.json files for all packages
12-
COPY packages/db/package.json ./packages/db/
11+
# Copy package.json files for all packages (exclude local db; use published @trycompai/db)
1312
COPY packages/kv/package.json ./packages/kv/
1413
COPY packages/ui/package.json ./packages/ui/
1514
COPY packages/email/package.json ./packages/email/
@@ -23,7 +22,7 @@ COPY apps/app/package.json ./apps/app/
2322
COPY apps/portal/package.json ./apps/portal/
2423

2524
# Install all dependencies
26-
RUN PRISMA_SKIP_POSTINSTALL_GENERATE=true bun install --frozen-lockfile
25+
RUN PRISMA_SKIP_POSTINSTALL_GENERATE=true bun install
2726

2827
# =============================================================================
2928
# STAGE 2: Ultra-Minimal Migrator - Only Prisma
@@ -32,20 +31,18 @@ FROM oven/bun:1.2.8 AS migrator
3231

3332
WORKDIR /app
3433

35-
# Copy Prisma schema and migration files
34+
# Copy local Prisma schema and migrations from workspace
3635
COPY packages/db/prisma ./packages/db/prisma
3736

38-
# Create minimal package.json for Prisma
39-
RUN echo '{"name":"migrator","type":"module","dependencies":{"prisma":"^6.13.0","@prisma/client":"^6.13.0"}}' > package.json
37+
# Create minimal package.json for Prisma runtime (also used by seeder)
38+
RUN echo '{"name":"migrator","type":"module","dependencies":{"prisma":"^6.14.0","@prisma/client":"^6.14.0","@trycompai/db":"^1.3.4","zod":"^3.25.7"}}' > package.json
4039

4140
# Install ONLY Prisma dependencies
4241
RUN bun install
4342

44-
# Generate Prisma client
45-
RUN cd packages/db && bunx prisma generate
46-
47-
# Default command for migrations
48-
CMD ["bunx", "prisma", "migrate", "deploy", "--schema=packages/db/prisma/schema.prisma"]
43+
# Run migrations against the combined schema published by @trycompai/db
44+
RUN echo "Running migrations against @trycompai/db combined schema"
45+
CMD ["bunx", "prisma", "migrate", "deploy", "--schema=node_modules/@trycompai/db/dist/schema.prisma"]
4946

5047
# =============================================================================
5148
# STAGE 3: App Builder
@@ -58,28 +55,52 @@ WORKDIR /app
5855
COPY packages ./packages
5956
COPY apps/app ./apps/app
6057

61-
# Generate Prisma client in the full workspace context
62-
RUN cd packages/db && bunx prisma generate
58+
# Bring in node_modules for build and prisma prebuild
59+
COPY --from=deps /app/node_modules ./node_modules
60+
61+
# Ensure Next build has required public env at build-time
62+
ARG NEXT_PUBLIC_BETTER_AUTH_URL
63+
ARG NEXT_PUBLIC_PORTAL_URL
64+
ARG NEXT_PUBLIC_POSTHOG_KEY
65+
ARG NEXT_PUBLIC_POSTHOG_HOST
66+
ARG NEXT_PUBLIC_IS_DUB_ENABLED
67+
ARG NEXT_PUBLIC_GTM_ID
68+
ARG NEXT_PUBLIC_LINKEDIN_PARTNER_ID
69+
ARG NEXT_PUBLIC_LINKEDIN_CONVERSION_ID
70+
ARG NEXT_PUBLIC_GOOGLE_ADS_CONVERSION_LABEL
71+
ARG NEXT_PUBLIC_API_URL
72+
ENV NEXT_PUBLIC_BETTER_AUTH_URL=$NEXT_PUBLIC_BETTER_AUTH_URL \
73+
NEXT_PUBLIC_PORTAL_URL=$NEXT_PUBLIC_PORTAL_URL \
74+
NEXT_PUBLIC_POSTHOG_KEY=$NEXT_PUBLIC_POSTHOG_KEY \
75+
NEXT_PUBLIC_POSTHOG_HOST=$NEXT_PUBLIC_POSTHOG_HOST \
76+
NEXT_PUBLIC_IS_DUB_ENABLED=$NEXT_PUBLIC_IS_DUB_ENABLED \
77+
NEXT_PUBLIC_GTM_ID=$NEXT_PUBLIC_GTM_ID \
78+
NEXT_PUBLIC_LINKEDIN_PARTNER_ID=$NEXT_PUBLIC_LINKEDIN_PARTNER_ID \
79+
NEXT_PUBLIC_LINKEDIN_CONVERSION_ID=$NEXT_PUBLIC_LINKEDIN_CONVERSION_ID \
80+
NEXT_PUBLIC_GOOGLE_ADS_CONVERSION_LABEL=$NEXT_PUBLIC_GOOGLE_ADS_CONVERSION_LABEL \
81+
NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL \
82+
NEXT_TELEMETRY_DISABLED=1 NODE_ENV=production \
83+
NEXT_OUTPUT_STANDALONE=true \
84+
NODE_OPTIONS=--max_old_space_size=6144
6385

6486
# Build the app
6587
RUN cd apps/app && SKIP_ENV_VALIDATION=true bun run build
6688

6789
# =============================================================================
6890
# STAGE 4: App Production
6991
# =============================================================================
70-
FROM oven/bun:1.2.8 AS app
92+
FROM node:22-alpine AS app
7193

7294
WORKDIR /app
7395

74-
# Copy the built app and all necessary dependencies from builder
75-
COPY --from=app-builder /app/apps/app/.next ./apps/app/.next
76-
COPY --from=app-builder /app/apps/app/package.json ./apps/app/
77-
COPY --from=app-builder /app/package.json ./
78-
COPY --from=app-builder /app/node_modules ./node_modules
79-
COPY --from=app-builder /app/packages ./packages
96+
# Copy Next standalone output
97+
COPY --from=app-builder /app/apps/app/.next/standalone ./
98+
COPY --from=app-builder /app/apps/app/.next/static ./apps/app/.next/static
99+
COPY --from=app-builder /app/apps/app/public ./apps/app/public
100+
80101

81102
EXPOSE 3000
82-
CMD ["bun", "run", "--cwd", "apps/app", "start"]
103+
CMD ["node", "apps/app/server.js"]
83104

84105
# =============================================================================
85106
# STAGE 5: Portal Builder
@@ -92,25 +113,32 @@ WORKDIR /app
92113
COPY packages ./packages
93114
COPY apps/portal ./apps/portal
94115

95-
# Generate Prisma client
96-
RUN cd packages/db && bunx prisma generate
116+
# Bring in node_modules for build and prisma prebuild
117+
COPY --from=deps /app/node_modules ./node_modules
118+
119+
# Ensure Next build has required public env at build-time
120+
ARG NEXT_PUBLIC_BETTER_AUTH_URL
121+
ENV NEXT_PUBLIC_BETTER_AUTH_URL=$NEXT_PUBLIC_BETTER_AUTH_URL \
122+
NEXT_TELEMETRY_DISABLED=1 NODE_ENV=production \
123+
NEXT_OUTPUT_STANDALONE=true \
124+
NODE_OPTIONS=--max_old_space_size=6144
97125

98126
# Build the portal
99127
RUN cd apps/portal && SKIP_ENV_VALIDATION=true bun run build
100128

101129
# =============================================================================
102130
# STAGE 6: Portal Production
103131
# =============================================================================
104-
FROM oven/bun:1.2.8 AS portal
132+
FROM node:22-alpine AS portal
105133

106134
WORKDIR /app
107135

108-
# Copy the built portal and all necessary dependencies from builder
109-
COPY --from=portal-builder /app/apps/portal/.next ./apps/portal/.next
110-
COPY --from=portal-builder /app/apps/portal/package.json ./apps/portal/
111-
COPY --from=portal-builder /app/package.json ./
112-
COPY --from=portal-builder /app/node_modules ./node_modules
113-
COPY --from=portal-builder /app/packages ./packages
136+
# Copy Next standalone output for portal
137+
COPY --from=portal-builder /app/apps/portal/.next/standalone ./
138+
COPY --from=portal-builder /app/apps/portal/.next/static ./apps/portal/.next/static
139+
COPY --from=portal-builder /app/apps/portal/public ./apps/portal/public
114140

115141
EXPOSE 3000
116-
CMD ["bun", "run", "--cwd", "apps/portal", "start"]
142+
CMD ["node", "apps/portal/server.js"]
143+
144+
# (Trigger.dev hosted; no local runner stage)

0 commit comments

Comments
 (0)