-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
57 lines (39 loc) · 1.25 KB
/
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
48
49
50
51
52
53
54
55
56
57
ARG BUILD_USER=build
ARG APPLICATION_USER=application
ARG NODE_VERSION=12.16.1
FROM node:${NODE_VERSION}-alpine as os
ARG BUILD_USER
ENV buildUser=$BUILD_USER
RUN addgroup -S appgroup && adduser -S $buildUser -G appgroup
USER $buildUser
WORKDIR /home/$buildUser
FROM os AS install
COPY package*.json ./
ADD .yarnrc ./
COPY yarn.lock ./
COPY babel.config.js ./
COPY patches/nestjs-flub+0.2.0.patch ./patches/nestjs-flub+0.2.0.patch
RUN yarn install --only=production
RUN cp -R node_modules /tmp/production_modules
RUN yarn install --frozen-lockfile
COPY . .
FROM install AS build
USER root
WORKDIR /home/$buildUser
RUN yarn build:backend
FROM node:${NODE_VERSION}-alpine
ARG APPLICATION_USER
ARG BUILD_USER
ENV applicationUser=$APPLICATION_USER
ENV buildUser=$BUILD_USER
RUN apk add --update --no-cache bash
RUN addgroup -S appgroup && adduser -S $applicationUser -G appgroup
WORKDIR /home/$applicationUser
COPY --from=install /tmp/production_modules node_modules
COPY --from=build /home/$buildUser/dist dist
COPY free.bcdapps.client.certificate free.bcdapps.client.certificate
COPY protos protos
RUN mkdir -p packages/backend/src/graphql
COPY packages/backend/src/**/*.graphql packages/backend/src/graphql/
EXPOSE 3000
CMD ["node", "dist/packages/backend/main.js"]