forked from EddieHubCommunity/api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
37 lines (24 loc) · 789 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
FROM node:15 as development
LABEL org.opencontainers.image.source https://github.com/eddiehubcommunity/api
ARG github_token
WORKDIR /usr/src/app
COPY package*.json ./
COPY .npmrc .npmrc
RUN echo "//npm.pkg.github.com/:_authToken=${github_token}" > ~/.npmrc
RUN npm install --ignore-scripts
RUN rm -f .npmrc
COPY . .
RUN npm run build
FROM node:15 as production
LABEL org.opencontainers.image.source https://github.com/eddiehubcommunity/api
ARG github_token
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
WORKDIR /usr/src/app
COPY package*.json ./
COPY .npmrc .npmrc
RUN echo "//npm.pkg.github.com/:_authToken=${github_token}" > ~/.npmrc
RUN npm install --production --ignore-scripts
COPY . .
COPY --from=development /usr/src/app/dist ./dist
CMD ["npm", "run", "start:prod"]