-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathDockerfile.prod
51 lines (33 loc) · 1.07 KB
/
Dockerfile.prod
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
51
##### DEPENDENCIES
FROM node:20-alpine3.19 AS deps
RUN apk add --no-cache libc6-compat
RUN apk update && apk upgrade openssl
WORKDIR /app
# Install dependencies based on the preferred package manager
COPY package.json pnpm-lock.yaml ./
COPY ./patches ./patches
RUN yarn global add pnpm@8 && pnpm install --shamefully-hoist --strict-peer-dependencies=false --frozen-lockfile
##### RUNNER
FROM node:20-alpine3.19 AS runner
WORKDIR /app
ENV REDIS_HTTP_USERNAME=user
ENV REDIS_HTTP_PASSWORD=password
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY --from=deps /app/node_modules ./node_modules
COPY ./public/ ./public/
COPY ./drizzle/ ./drizzle/
COPY ./migrate.mjs .
COPY ./next.config.mjs .
COPY ./package.json .
COPY ./custom-incremental-cache-handler.mjs .
COPY --chown=nextjs:nodejs .next/standalone ./
COPY --chown=nextjs:nodejs .next/static ./.next/static
USER nextjs
EXPOSE 80
ENV PORT=80
ENV NODE_ENV=production
ENV HOSTNAME=0.0.0.0
CMD ["sh", "-c", "node migrate.mjs && node server.js"]