-
Notifications
You must be signed in to change notification settings - Fork 19
/
Dockerfile
46 lines (32 loc) · 1.02 KB
/
Dockerfile
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
##### DEPENDENCIES
FROM node:20-alpine AS deps
RUN apk add --no-cache libc6-compat openssl g++ make python3
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN \
if [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i; \
else echo "PNPM lockfile not found." && exit 1; \
fi
##### BUILDER
FROM node:20-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
ENV NEXT_TELEMETRY_DISABLED 1
RUN yarn global add pnpm && SKIP_ENV_VALIDATION=1 IS_BUILDING=1 pnpm run build;
RUN node scripts/build.mjs;
##### RUNNER
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
COPY --from=builder /app/scripts-dist ./scripts-dist
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/drizzle ./drizzle
EXPOSE 3000
ENV PORT 3000
CMD ["server.js"]