-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
46 lines (30 loc) · 851 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
ARG NODE_VERSION
# --- Base Node ---
FROM node:${NODE_VERSION}-alpine as base
ENV ROOT_PATH /var/guava
ENV NODE_ENV production
RUN mkdir -p ${ROOT_PATH}
WORKDIR ${ROOT_PATH}
RUN mkdir -p library
RUN mkdir -p app
COPY ./package.json ./yarn.lock ./
COPY library/package.json ./library
COPY app/package.json ./app
# -- Dependencies --
FROM base as dependencies
RUN mkdir -p /var/yarn-cache
RUN yarn config set cache-folder /var/yarn-cache
RUN yarn install --pure-lockfile --production=false
# -- Source -- #
FROM dependencies as source
WORKDIR ${ROOT_PATH}
COPY . .
# -- Production -- #
FROM source as production
RUN yarn workspace @guava/app build
# -- Nginx server -- #
FROM nginx:alpine as server
COPY --from=production /var/guava/app/build /var/www
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD [ "nginx", "-g", "daemon off;" ]