-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
39 lines (27 loc) · 820 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
36
37
38
39
ARG NODE_VERSION
ARG PORT
FROM node:${NODE_VERSION} as intermediate
RUN mkdir ./swap
## Install app dependencies
COPY package*.json ./swap/
# Install deps and wipe clean
RUN cd ./swap && yarn install \
&& npm cache clear --force \
&& rm -rf ~/.npm \
&& rm -rf /var/lib/apt/lists/*
# Bundle app source (see dockerignore)
COPY . ./swap
RUN cd ./swap && yarn build
####
## INNER
####
FROM node:${NODE_VERSION}-alpine
# Create app directory
WORKDIR /usr/src/app
COPY --from=intermediate /swap/node_modules /usr/src/app/node_modules
COPY --from=intermediate /swap/.next /usr/src/app/.next
COPY --from=intermediate /swap/public /usr/src/app/public
COPY --from=intermediate /swap/package.json /usr/src/app/
COPY --from=intermediate /swap/next.config.js /usr/src/app/
EXPOSE ${PORT}
CMD [ "yarn", "start" ]