-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
31 lines (27 loc) · 938 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
FROM node:12.13-buster AS base
RUN mkdir /app && chown -R node:node /app
WORKDIR /app
USER node
COPY --chown=node:node package.json yarn.lock ./
FROM base AS dependencies
RUN yarn install --production
RUN cp -R node_modules prod_node_modules
RUN yarn install
RUN cp -R node_modules/graphql-voyager prod_node_modules/
FROM dependencies AS source
COPY --chown=node:node . .
FROM source AS build
RUN yarn build
FROM node:12.13-buster-slim AS release
ENV TINI_VERSION v0.18.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
RUN mkdir /app && chown -R node:node /app
WORKDIR /app
USER node
COPY --chown=node:node package.json yarn.lock ./
COPY --chown=node:node --from=build /app/dist /app/dist
COPY --chown=node:node --from=build /app/.env /app/.env
COPY --chown=node:node --from=dependencies /app/prod_node_modules /app/node_modules
ENTRYPOINT ["/tini", "--"]
CMD ["node", "dist/main"]