Skip to content

Commit efdb93f

Browse files
author
keval0406
committed
Resolved merge conflicts
2 parents 8f656c9 + 8869ebe commit efdb93f

File tree

6 files changed

+91
-43
lines changed

6 files changed

+91
-43
lines changed

docker-compose.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff 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:

frontend/Dockerfile

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
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"]

frontend/docker-compose.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: '3.8'
2+
services:
3+
nextjs:
4+
build: .
5+
ports:
6+
- "3000:3000"
7+
environment:
8+
- NODE_ENV=production

frontend/next.config.mjs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
21
/** @type {import('next').NextConfig} */
32
const nextConfig = {
4-
5-
3+
output: "standalone",
64
};
75

8-
9-
10-
export default nextConfig
6+
export default nextConfig;

nexus/Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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"]

nexus/docker-compose.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: '3.8'
2+
services:
3+
nextjs:
4+
build: .
5+
ports:
6+
- "3000:3000"
7+
environment:
8+
- NODE_ENV=production

0 commit comments

Comments
 (0)