File tree Expand file tree Collapse file tree 6 files changed +91
-43
lines changed
Expand file tree Collapse file tree 6 files changed +91
-43
lines changed Original file line number Diff line number Diff line change @@ -13,23 +13,23 @@ services:
1313 networks :
1414 - app-network
1515
16- # frontend:
17- # build:
18- # context: ./frontend
19- # dockerfile: Dockerfile
20- # ports:
21- # - "3000:3000"
22- # environment:
23- # - NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
24- # - NEXT_PUBLIC_API_KEY=${NEXT_PUBLIC_API_KEY}
25- # - API_KEY=${API_KEY}
26- # - GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID}
27- # - GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET}
28- # - GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
29- # - GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
30- # - NEXTAUTH_SECRET=${NEXTAUTH_SECRET}
31- # networks:
32- # - app-network
16+ frontend :
17+ build :
18+ context : ./frontend
19+ dockerfile : Dockerfile
20+ ports :
21+ - " 3000:3000"
22+ environment :
23+ - NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
24+ - NEXT_PUBLIC_API_KEY=${NEXT_PUBLIC_API_KEY}
25+ - API_KEY=${API_KEY}
26+ - GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID}
27+ - GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET}
28+ - GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
29+ - GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
30+ - NEXTAUTH_SECRET=${NEXTAUTH_SECRET}
31+ networks :
32+ - app-network
3333
3434 backend :
3535 build :
Original file line number Diff line number Diff line change 1- # # Alternative Dockerfile for projects without bun.lockb
2- # FROM oven/bun:1 AS base
3- # WORKDIR /usr/src/app
1+ FROM oven/bun:1 AS deps
2+ WORKDIR /app
43
5- # RUN apt-get update -y && apt-get install -y openssl
4+ # Copy package files
5+ COPY package.json bun.lockb* ./
6+ RUN bun install --frozen-lockfile
67
7- # # Install dependencies
8- # FROM base AS deps
9- # COPY package.json ./
10- # RUN bun install
8+ FROM node:20-alpine AS builder
9+ WORKDIR /app
1110
12- # # Generate Prisma client
13- # FROM deps AS builder
14- # COPY . .
15- # RUN bunx prisma generate
11+ COPY --from=deps /app/node_modules ./node_modules
12+ COPY . .
1613
17- # # Production image
18- # FROM base AS runner
19- # COPY --from=deps /usr/src/app/node_modules ./node_modules
20- # COPY . .
14+ RUN npm run build
2115
22- # # Generate Prisma client in production
23- # RUN bunx prisma generate
16+ FROM oven/bun:1-alpine AS runner
17+ WORKDIR /app
2418
25- # # Expose port
26- # EXPOSE 3000
19+ # Create non-root user
20+ RUN addgroup --system --gid 1001 nodejs && \
21+ adduser --system --uid 1001 nextjs
22+
23+ COPY --from=builder /app/public ./public
24+ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
25+ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
26+
27+ USER nextjs
28+
29+ EXPOSE 3000
30+
31+ CMD ["bun" , "run" , "server.js" ]
Original file line number Diff line number Diff line change 1+ version : ' 3.8'
2+ services :
3+ nextjs :
4+ build : .
5+ ports :
6+ - " 3000:3000"
7+ environment :
8+ - NODE_ENV=production
Original file line number Diff line number Diff line change 1-
21/** @type {import('next').NextConfig } */
32const nextConfig = {
4-
5-
3+ output : "standalone" ,
64} ;
75
8-
9-
10- export default nextConfig
6+ export default nextConfig ;
Original file line number Diff line number Diff line change 1+ FROM oven/bun:1 AS deps
2+ WORKDIR /app
3+
4+ # Copy package files
5+ COPY package.json bun.lockb* ./
6+ RUN bun install --frozen-lockfile
7+
8+ FROM node:20-alpine AS builder
9+ WORKDIR /app
10+
11+ COPY --from=deps /app/node_modules ./node_modules
12+ COPY . .
13+
14+ RUN npm run build
15+
16+ FROM oven/bun:1-alpine AS runner
17+ WORKDIR /app
18+
19+ # Create non-root user
20+ RUN addgroup --system --gid 1001 nodejs && \
21+ adduser --system --uid 1001 nextjs
22+
23+ COPY --from=builder /app/public ./public
24+ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
25+ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
26+
27+ USER nextjs
28+
29+ EXPOSE 3000
30+
31+ CMD ["bun" , "run" , "server.js" ]
Original file line number Diff line number Diff line change 1+ version : ' 3.8'
2+ services :
3+ nextjs :
4+ build : .
5+ ports :
6+ - " 3000:3000"
7+ environment :
8+ - NODE_ENV=production
You can’t perform that action at this time.
0 commit comments