generated from mojaloop/typescript-svc-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
43 lines (32 loc) · 908 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
ARG NODE_VERSION=lts-alpine
# NOTE: Ensure you set NODE_VERSION Build Argument as follows...
#
# export NODE_VERSION="$(cat .nvmrc)-alpine" \
# docker build \
# --build-arg NODE_VERSION=$NODE_VERSION \
# -t mojaloop/repo-name:local \
# . \
#
FROM node:${NODE_VERSION} as builder
#RUN apk add --no-cache git python3 build-base
WORKDIR /opt/app
## Copy basic files for installing dependencies
COPY tsconfig.json package*.json ./
COPY src ./src
RUN npm ci
## Build the app
RUN npm run build
## *Application*
FROM node:${NODE_VERSION}
#RUN apk add --no-cache git python3 g++ make
WORKDIR /opt/app
COPY package*.json ./
RUN npm ci --omit=dev
# Create a non-root user: ml-user
RUN adduser -D ml-user
USER ml-user
## Copy of dist directory from builder
COPY --chown=ml-user --from=builder /opt/app/dist ./dist
## Expose any application ports
# EXPOSE <PORT>
CMD [ "node" , "./dist/index.js" ]