-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
39 lines (30 loc) · 1.01 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
FROM node:16-alpine AS base
RUN apk update && apk add git
WORKDIR /app
RUN yarn global add turbo
FROM base AS prune
WORKDIR /app
COPY . .
RUN turbo prune --scope=web --docker
FROM prune AS build_deps
COPY --from=prune /app/out/json .
COPY --from=prune /app/out/yarn.lock ./yarn.lock
RUN yarn install
FROM prune AS prod_deps
RUN yarn workspaces focus --all --production
FROM build_deps AS build
WORKDIR /app
COPY --from=prune /app/out/full/ .
RUN npx prisma generate
RUN turbo run build --scope=web --filter=true --no-deps
FROM node:16-alpine AS deploy
COPY .env .env
ENV NODE_ENV production
RUN addgroup -g 1001 -S nextjs
RUN adduser -S nextjs -u 1001
COPY --from=build --chown=nexts:nextjs /app/apps/web/.next .next
COPY --from=build --chown=nexts:nextjs /app/apps/web/public ./public
COPY --from=build --chown=nexts:nextjs /app/apps/web/prisma ./prisma
COPY --from=build --chown=nexts:nextjs /app/apps/web/package.json ./package.json
COPY --from=prod_deps --chown=nextjs:nextjs /app/node_modules node_modules
USER nextjs