-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.frontend
52 lines (34 loc) · 1.39 KB
/
Dockerfile.frontend
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
52
# Please keep this section in sync with the other Dockerfile
FROM node:20-alpine AS base
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
ENV NODE_ENV=production
ENV YARN_VERSION=4.4.1
WORKDIR /app/
RUN corepack enable &&\
corepack prepare yarn@${YARN_VERSION} &&\
echo 'nodeLinker: node-modules' > .yarnrc.yml &&\
mkdir backend/ frontend/
FROM base AS builder
COPY package.json yarn.lock ./
COPY frontend/package.json ./frontend/
COPY backend/package.json ./backend/
RUN yarn install --immutable
# ------------ END OF COMMON STEPS -------------- #
COPY .eslint* .prettier* ./
COPY ./frontend/ ./frontend/
# Only used for vercel previews
RUN rm -f ./frontend/pages/api/\[\[...slug\]\].ts
RUN yarn workspace frontend run build
# ======================================================== #
# ======================== RUNNER ======================== #
# ======================================================== #
FROM base AS runner
WORKDIR /app
COPY --from=builder /app/frontend/public ./public/
COPY --from=builder /app/frontend/.next/standalone/node_modules/ ./node_modules/
COPY --from=builder /app/frontend/.next/standalone/frontend/ ./
COPY --from=builder /app/frontend/.next/static/ ./.next/static/
ENV PORT=3000
EXPOSE 3000
CMD ["node", "/app/server.js"]