-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.frontend
31 lines (22 loc) · 741 Bytes
/
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
# Stage 1: Building the code
FROM node:alpine as BUILD_IMAGE
WORKDIR /app
COPY frontend/package.json frontend/bun.lockb frontend/yarn.lock ./
COPY frontend/ ./
ARG NEXT_PUBLIC_API_URL
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
ARG NEXT_RENDER_PUBLIC_API_URL
ENV NEXT_RENDER_PUBLIC_API_URL=${NEXT_RENDER_PUBLIC_API_URL}
ARG NEXT_SSR_CACHE_METHOD
ENV NEXT_SSR_CACHE_METHOD=${NEXT_SSR_CACHE_METHO}
ENV NODE_ENV=production
RUN yarn install --frozen-lockfile
RUN yarn run build
RUN npm prune --production
FROM node:alpine
WORKDIR /app
COPY --from=BUILD_IMAGE /app/package.json ./package.json
COPY --from=BUILD_IMAGE /app/node_modules ./node_modules
COPY --from=BUILD_IMAGE /app/.next ./.next
EXPOSE 3000
CMD ["yarn", "run", "start"]