forked from vatger/pilot-mentoring-programme
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (34 loc) · 1.17 KB
/
Dockerfile
File metadata and controls
50 lines (34 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# ---- BUILDER ----
FROM node:20-bookworm AS builder
WORKDIR /app
# Install OpenSSL which Prisma requires
RUN apt-get update -y && apt-get install -y openssl && rm -rf /var/lib/apt/lists/*
# 1. Package.json + Lockfile kopieren
COPY package.json package-lock.json ./
# 2. Node Modules installieren (inkl. @prisma/client)
RUN npm install
# 3. Prisma Schema kopieren
COPY prisma ./prisma
# 4. Prisma Client generieren (Dummy DATABASE_URL)
ENV DATABASE_URL="mysql://user:pass@localhost:3306/dummy"
RUN npx prisma generate
# 5. Restlichen Code kopieren
COPY . .
# 6. Next.js Build
RUN npm run build
# ---- RUNNER ----
FROM node:20-bookworm-slim AS runner
# Install OpenSSL in runtime image as well
RUN apt-get update -y && apt-get install -y openssl && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# 1. Next.js Standalone Build kopieren
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
# 2. Prisma Schema kopieren (wird für Prisma Client benötigt)
COPY --from=builder /app/prisma ./prisma
# 3. Öffentliche Assets kopieren
COPY --from=builder /app/public ./public
ENV PORT=8000
ENV HOSTNAME=0.0.0.0
EXPOSE 8000
CMD ["node", "server.js"]