-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
47 lines (29 loc) · 920 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
FROM node:14.18-alpine As development
ARG NPM_TOKEN
#ENV NPM_EMAIL="[email protected]"
#ENV NPM_REGISTRY="https://npm.pkg.github.com"
#ENV NPM_SCOPE="@wodo-platform"
#ENV NPM_TOKEN=${NPM_TOKEN}
WORKDIR /usr/src/app
COPY package*.json ./
RUN echo "@wodo-platform:registry=https://npm.pkg.github.com/" > .npmrc
RUN echo "//npm.pkg.github.com/:_authToken=${NPM_TOKEN}" >> .npmrc && \
npm install && \
rm -f .npmrc
RUN npm install
COPY . .
RUN npm run build
FROM node:14.18-alpine as production
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
WORKDIR /usr/src/app
COPY package*.json ./
COPY . .
# TODO: find a better way to bundle dependencies with nestjs.
COPY --from=development /usr/src/app/node_modules ./node_modules
COPY --from=development /usr/src/app/dist ./dist
ARG PORT=3000
ENV PORT=${PORT}
EXPOSE ${PORT}
# Start the application
CMD ["npm", "run", "start:prod"]