forked from mojaloop/central-ledger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
34 lines (25 loc) · 942 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
FROM node:12.16.1-alpine as builder
WORKDIR /opt/central-ledger
RUN apk add --no-cache -t build-dependencies git make gcc g++ python libtool 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/central-ledger/
RUN npm install
COPY src /opt/central-ledger/src
COPY config /opt/central-ledger/config
COPY migrations /opt/central-ledger/migrations
COPY seeds /opt/central-ledger/seeds
COPY test /opt/central-ledger/test
FROM node:12.16.1-alpine
WORKDIR /opt/central-ledger
# Create empty log file & link stdout to the application log file
RUN mkdir ./logs && touch ./logs/combined.log
RUN ln -sf /dev/stdout ./logs/combined.log
# Create a non-root user: ml-user
RUN adduser -D ml-user
USER ml-user
COPY --chown=ml-user --from=builder /opt/central-ledger .
RUN npm prune --production
EXPOSE 3001
CMD ["npm", "run", "start"]