Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit e8a46e2

Browse files
committed
Update Docker configuration, enhance .env.production for authentication and API integration, and modify Next.js settings for improved build process. Add OpenSSL installation in Dockerfile and streamline environment variable management.
1 parent a60f5cd commit e8a46e2

5 files changed

Lines changed: 83 additions & 58 deletions

File tree

.dockerignore

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,34 @@
1+
# Docker
12
Dockerfile
23
.dockerignore
3-
node_modules
4-
npm-debug.log
4+
5+
# Next.js
6+
.next/
7+
out/
8+
9+
# Node.js / Bun
10+
node_modules/
11+
# bun.lockb
12+
npm-debug.log*
13+
yarn-debug.log*
14+
yarn-error.log*
15+
.pnpm-debug.log*
16+
17+
# Environment variables
18+
*.env
19+
.env*
20+
!.env.example
21+
!.env.production.example
22+
23+
# Prisma (adjust as necessary)
24+
# prisma/generated/
25+
26+
# Misc
27+
.DS_Store
28+
*.pem
29+
*.key
30+
531
README.md
6-
.next
732
.git
833
.gitignore
934
.env*

.env.production

Lines changed: 17 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,69 +2,37 @@
22
# App - Don't add "/" in the end of the url (same in production)
33
# -----------------------------------------------------------------------------
44
NEXT_PUBLIC_APP_URL=http://localhost:3000
5-
5+
NEXTAUTH_URL=http://localhost:3000
66
# -----------------------------------------------------------------------------
77
# Authentication (NextAuth.js)
88
# -----------------------------------------------------------------------------
9-
AUTH_SECRET="your-auth-secret"
10-
11-
GOOGLE_CLIENT_ID=your-google-client-id
12-
GOOGLE_CLIENT_SECRET=your-google-client-secret
9+
AUTH_SECRET="testtest"
1310

14-
# -----------------------------------------------------------------------------
15-
# LLM API
16-
# -----------------------------------------------------------------------------
17-
GROQ_API_KEY="your-groq-api-key"
18-
19-
# -----------------------------------------------------------------------------
20-
# LLM Models
21-
# -----------------------------------------------------------------------------
22-
GROQ_MODEL="meta-llama/llama-4-scout-17b-16e-instruct"
11+
GOOGLE_CLIENT_ID="testtest"
12+
GOOGLE_CLIENT_SECRET="testtest"
2313

2414
# -----------------------------------------------------------------------------
2515
# Database (Postgresql - Neon DB)
2616
# -----------------------------------------------------------------------------
27-
DATABASE_URL="postgresql://username:password@hostname/database?sslmode=require"
17+
DATABASE_URL="postgresql://test:test@eaws.tech/aion-time-dev?sslmode=require"
18+
19+
API_URL="https://ashref.tn"
2820

2921
# -----------------------------------------------------------------------------
30-
# Subscriptions (Stripe)
22+
# Resend
3123
# -----------------------------------------------------------------------------
32-
STRIPE_API_KEY=your-stripe-api-key
33-
STRIPE_WEBHOOK_SECRET=your-stripe-webhook-secret
34-
35-
NEXT_PUBLIC_STRIPE_PRO_MONTHLY_PLAN_ID=your-stripe-pro-monthly-plan-id
36-
NEXT_PUBLIC_STRIPE_PRO_YEARLY_PLAN_ID=your-stripe-pro-yearly-plan-id
37-
38-
NEXT_PUBLIC_STRIPE_BUSINESS_MONTHLY_PLAN_ID=your-stripe-business-monthly-plan-id
39-
NEXT_PUBLIC_STRIPE_BUSINESS_YEARLY_PLAN_ID=your-stripe-business-yearly-plan-id
24+
RESEND_API_KEY=re_EKPxypJ8_96Xu4qqLYwJUYdxWVF8qm9YZ
25+
EMAIL_FROM="AionTime <onboarding@resend.dev>"
4026

4127
# -----------------------------------------------------------------------------
42-
# AWS S3
28+
# Subscriptions (Stripe)
4329
# -----------------------------------------------------------------------------
44-
AWS_ACCESS_KEY_ID=your-aws-access-key-id
45-
AWS_SECRET_ACCESS_KEY=your-aws-secret-access-key
46-
AWS_REGION=your-aws-region
47-
AWS_S3_BUCKET=your-s3-bucket
48-
AWS_BEDROCK_ACCESS_KEY_ID=your-aws-bedrock-access-key-id
49-
AWS_BEDROCK_SECRET_ACCESS_KEY=your-aws-bedrock-secret-access-key
30+
STRIPE_API_KEY="testtest"
31+
STRIPE_WEBHOOK_SECRET="testest"
5032

51-
# Add these variables for file upload functionality
52-
CLOUD_AWS_ACCESS_KEY_ID=your-cloud-aws-access-key-id
53-
CLOUD_AWS_SECRET_ACCESS_KEY=your-cloud-aws-secret-access-key
54-
CLOUD_AWS_REGION=your-cloud-aws-region
55-
CLOUD_AWS_S3_BUCKET=your-cloud-aws-s3-bucket
33+
NEXT_PUBLIC_STRIPE_PRO_MONTHLY_PLAN_ID=testtest
34+
NEXT_PUBLIC_STRIPE_PRO_YEARLY_PLAN_ID=testtest
5635

57-
# -----------------------------------------------------------------------------
58-
# Email
59-
# -----------------------------------------------------------------------------
60-
EMAIL_SERVER_USER=your-email-server-user
61-
EMAIL_SERVER_PASSWORD=your-email-server-password
62-
EMAIL_SERVER_HOST=your-email-server-host
63-
EMAIL_SERVER_PORT=587
64-
EMAIL_FROM=info@example.com
65-
EMAIL_SERVER=smtp://user:password@host:port
36+
NEXT_PUBLIC_STRIPE_BUSINESS_MONTHLY_PLAN_ID=testtest
37+
NEXT_PUBLIC_STRIPE_BUSINESS_YEARLY_PLAN_ID=testtest
6638

67-
# -----------------------------------------------------------------------------
68-
# PDF.co API
69-
# -----------------------------------------------------------------------------
70-
OCR_API_KEY=your-ocr-api-key

Dockerfile

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
FROM oven/bun:1 AS base
1+
FROM oven/bun:1-alpine AS base
22

33
# Install dependencies only when needed
44
FROM base AS deps
55

66
WORKDIR /app
77

8+
# Install OpenSSL for Prisma
9+
RUN apk add --no-cache openssl
10+
811
# Copy package files and prisma schema
912
COPY package.json bun.lock ./
1013
COPY prisma ./prisma
1114

1215
COPY .env.production .env
1316

1417
# Install dependencies and generate prisma client
15-
RUN bunx prisma generate
1618
RUN bun install --frozen-lockfile
19+
RUN bunx prisma generate
1720

1821
# Rebuild the source code only when needed
1922
FROM base AS builder
@@ -26,7 +29,8 @@ COPY . .
2629
# Uncomment the following line in case you want to disable telemetry during the build.
2730
ENV NEXT_TELEMETRY_DISABLED 1
2831

29-
RUN bun run build
32+
# Install OpenSSL here as well if build script reruns prisma generate, and increase memory for build
33+
RUN apk add --no-cache openssl && NODE_OPTIONS=--max-old-space-size=4096 bun run build
3034

3135
# Production image, copy all the files and run next
3236
FROM base AS runner
@@ -36,9 +40,12 @@ ENV NODE_ENV production
3640
# Uncomment the following line in case you want to disable telemetry during runtime.
3741
ENV NEXT_TELEMETRY_DISABLED 1
3842

39-
RUN adduser --system --uid 1001 nextjs
43+
# The 'bun' group should already exist in the oven/bun base image.
44+
# We will add the 'nextjs' user to this existing 'bun' group.
45+
RUN adduser --system --uid 1001 --ingroup bun nextjs
4046

4147
COPY --from=builder /app/public ./public
48+
COPY --from=builder /app/prisma ./prisma
4249

4350
# Set the correct permission for prerender cache
4451
RUN mkdir .next
@@ -49,12 +56,17 @@ RUN chown nextjs:bun .next
4956
COPY --from=builder --chown=nextjs:bun /app/.next/standalone ./
5057
COPY --from=builder --chown=nextjs:bun /app/.next/static ./.next/static
5158

59+
# Add start.sh script
60+
COPY start.sh /app/start.sh
61+
RUN chmod +x /app/start.sh
62+
5263
USER nextjs
5364

5465
EXPOSE 3000
5566

5667
ENV PORT 3000
68+
# ENV HOSTNAME=0.0.0.0 # Bun typically defaults to 0.0.0.0 when a port is specified
5769

5870
# server.js is created by next build from the standalone output
5971
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
60-
CMD ["bun", "server.js"]
72+
CMD ["/app/start.sh"]

next.config.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,17 @@ import { withContentlayer } from "next-contentlayer2";
88
import "./env.mjs";
99

1010
const nextConfig: NextConfig = {
11-
11+
output: "standalone",
12+
eslint: {
13+
// Warning: This disables ESLint during builds.
14+
// Ensure ESLint is run as a separate step in your CI/CD pipeline.
15+
ignoreDuringBuilds: true,
16+
},
17+
typescript: {
18+
// Warning: This disables type checking during builds.
19+
// Ensure type checking is run as a separate step in your CI/CD pipeline.
20+
ignoreBuildErrors: true,
21+
},
1222
experimental: {
1323
serverActions: {
1424
bodySizeLimit: "6mb",

start.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# Run Prisma migrations
5+
echo "Running Prisma migrations..."
6+
bunx prisma migrate deploy
7+
8+
# Start the application
9+
echo "Starting application..."
10+
exec bun server.js

0 commit comments

Comments
 (0)