-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
35 lines (27 loc) · 865 Bytes
/
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
# docs.partner-api.ice.id docker image build
# author: ICE Squad
FROM public.ecr.aws/docker/library/node:18-alpine AS deps
WORKDIR /app
# Installing nodejs packages/modules
COPY package.json ./
# NOTES: also copy the yarn.lock for consistency between developers
COPY yarn.lock ./
RUN yarn install
FROM public.ecr.aws/docker/library/node:18-alpine AS builder
# Environment variable / build arguments
# ARG foobar
WORKDIR /app
COPY . .
COPY --from=deps /app/node_modules ./node_modules
# Build Next.js
RUN yarn build
# COPY compiled files from build/deps image to runner
FROM public.ecr.aws/docker/library/node:18-alpine AS runner
ENV NODE_ENV production
WORKDIR /app
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/.next/standalone ./
EXPOSE 3000
ENV PORT 3000
CMD ["node", "server.js"]