forked from mojaloop/quoting-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
38 lines (26 loc) · 867 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
FROM node:16.15.0-alpine as builder
USER root
WORKDIR /opt/app
RUN apk --no-cache add git
RUN apk add --no-cache -t build-dependencies make gcc g++ python3 libtool libressl-dev openssl-dev autoconf automake \
&& cd $(npm root -g)/npm \
&& npm config set unsafe-perm true \
&& npm install -g node-gyp
COPY package.json package-lock.json* /opt/app/
RUN npm ci
RUN apk del build-dependencies
COPY src /opt/app/src
COPY config /opt/app/config
FROM node:16.15.0-alpine
WORKDIR /opt/app
# Create empty log file & link stdout to the application log file
RUN mkdir ./logs && touch ./logs/combined.log
# Links combined to stdout
RUN ln -sf /dev/stdout ./logs/combined.log
# Create a non-root user:app-user
RUN adduser -D app-user
USER app-user
COPY --chown=app-user --from=builder /opt/app .
RUN npm prune --production
EXPOSE 3002
CMD ["npm", "start"]