-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (33 loc) · 892 Bytes
/
Dockerfile
File metadata and controls
51 lines (33 loc) · 892 Bytes
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
# build environment
FROM node:16.14-bullseye as build
WORKDIR /app
ARG API_VERSION=latest
ARG GH_TOKEN=''
ENV PATH /app/node_modules/.bin:$PATH
COPY . ./
RUN echo "//npm.pkg.github.com/:_authToken=$GH_TOKEN" >> ./.npmrc
RUN npm install
RUN sed -i 's/development/'$API_VERSION'/' /app/version.json
RUN npm run build
RUN npm run test
# production environment
FROM node:16.14-bullseye-slim
RUN set -ex \
&& apt-get update \
&& apt-get install -y build-essential make python3 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
ARG PORT=80
ARG GH_TOKEN=''
ENV PATH /app/node_modules/.bin:$PATH
ENV NODE_ENV=production
COPY .npmrc ./
RUN echo "//npm.pkg.github.com/:_authToken=$GH_TOKEN" >> ./.npmrc
COPY package.json ./
COPY package-lock.json ./
RUN npm install --production
COPY --from=build /app/dist ./dist
ENV PORT=$PORT \
APP_ENV=
EXPOSE $PORT
CMD ["node", "dist/main"]