forked from celo-org/celo-oracle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
50 lines (33 loc) · 1.22 KB
/
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
44
45
46
47
48
49
50
# How to build:
# export COMMIT_SHA=$(git rev-parse HEAD)
# docker build -f Dockerfile --build-arg COMMIT_SHA=$COMMIT_SHA -t oracletest.azurecr.io/test/oracle:$COMMIT_SHA .
# How to push to registry
# az acr login -n oracletest
# docker push oracletest.azurecr.io/test/oracle:$COMMIT_SHA
# First stage, builder to install devDependencies to build TypeScript
FROM node:12 as BUILDER
RUN apt-get update
RUN apt-get install -y libusb-1.0-0-dev
WORKDIR /celo-oracle
# ensure yarn.lock is evaluated by kaniko cache diff
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile --network-timeout 100000 && yarn cache clean
COPY tsconfig.json ./
# copy contents
COPY src src
# build contents
RUN yarn build
# Second stage, create slimmed down production-ready image
FROM node:12
ARG COMMIT_SHA
RUN apt-get update
RUN apt-get install -y libusb-1.0-0-dev
WORKDIR /celo-oracle
ENV NODE_ENV production
COPY package.json package.json yarn.lock tsconfig.json readinessProbe.sh ./
COPY --from=BUILDER /celo-oracle/lib ./lib
RUN yarn install --production --frozen-lockfile --network-timeout 100000 && yarn cache clean
RUN echo $COMMIT_SHA > /version
RUN ["chmod", "+x", "/celo-oracle/readinessProbe.sh"]
USER 1000:1000
CMD yarn start