-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
47 lines (35 loc) · 1004 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
40
41
42
43
44
45
46
47
########################################################################
# BUILD APPLICATION
########################################################################
FROM node:10.16-alpine AS builder
# APP DIR
RUN mkdir -p /app
WORKDIR /app
# COPY PACKAGE DEPENDENCIES
COPY package.json .
COPY yarn.lock .
# INSTALL PACKAGES
RUN yarn install --silent --non-interactive
# COPY PROJECT FILES
COPY . .
# BUILD APP
RUN yarn build
########################################################################
# SERVER APPLICATION STEP
########################################################################
FROM node:10.16-alpine
# CONFIGURE ENVIRONMENT
ENV NODE_ENV=production \
PORT=80
# CONFIGURE APP DIR
RUN mkdir -p /app
WORKDIR /app
# COPY PROJECT FILE BUILDED
COPY --from=builder /app/package.json .
COPY --from=builder /app/yarn.lock .
COPY --from=builder /app/dist .
# INSTALL DEPENDENCIES
RUN yarn --prod --silent --no-interactive
# EXPOSE PORT TO WORK
EXPOSE 80 443
CMD ["yarn", "start"]