-
Notifications
You must be signed in to change notification settings - Fork 6
/
builder.Containerfile
65 lines (45 loc) · 1.08 KB
/
builder.Containerfile
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
58
59
60
61
62
63
64
65
# Base Stage
# --------------------
FROM node:lts-alpine as base
WORKDIR /app
RUN chown node:node /app
USER node
COPY --chown=node:node package*.json ./
# Source Stage
# --------------------
FROM base as source
ARG NODE_ENV=development
ENV NODE_ENV=${NODE_ENV}
RUN npm ci --ignore-scripts
#COPY --chown=node:node .eslintrc.json ./
COPY --chown=node:node tsconfig*.json ./
COPY --chown=node:node ./src ./src
# Testing and Linting
# --------------------
#FROM source as testing
#
## RUN npm run test
#RUN npm run lint
# Typescript Compilation
# --------------------
FROM source as builder
# Compile src/*.ts into dist/*.js
RUN npm run build
# Pre Production
# --------------------
FROM base as preprod
ARG APP_CONFIG_FILE=/config/config.json
ENV APP_CONFIG_FILE=${APP_CONFIG_FILE}
ARG APP_LOG_LEVEL=info
ENV APP_LOG_LEVEL=${APP_LOG_LEVEL}
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
RUN npm ci --ignore-scripts
COPY --from=builder /app/dist ./dist
# Production
# --------------------
FROM preprod as production
#health probe
EXPOSE 3000
VOLUME ["/config"]
CMD ["node", "dist/index.js"]