-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
51 lines (35 loc) · 1.17 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
51
# 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:20.11 as BUILDER
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN apt-get update
RUN apt-get install -y libusb-1.0-0-dev
WORKDIR /celo-oracle
# ensure pnpm-lock.yaml is evaluated by kaniko cache diff
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY tsconfig.json ./
# copy contents
COPY src src
# build contents
RUN pnpm run build
# Second stage, create slimmed down production-ready image
FROM node:20.11
ARG COMMIT_SHA
ENV NODE_ENV production
RUN corepack enable
WORKDIR /celo-oracle
COPY package.json package.json pnpm-lock.yaml tsconfig.json readinessProbe.sh ./
COPY --from=BUILDER /celo-oracle/lib ./lib
RUN pnpm install --frozen-lockfile
RUN echo $COMMIT_SHA > /version
RUN ["chmod", "+x", "/celo-oracle/readinessProbe.sh"]
USER 1000:1000
CMD pnpm run start