forked from smartcontractkit/chainlink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchainlink.Dockerfile
78 lines (61 loc) · 2.17 KB
/
chainlink.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# MAKE ALL CHANGES WITHIN THE DEFAULT WORKDIR FOR YARN AND GO DEP CACHE HITS
FROM node:12-buster
WORKDIR /chainlink
COPY GNUmakefile VERSION ./
COPY tools/bin/ldflags tools/bin/ldflags
ARG COMMIT_SHA
# Install yarn dependencies
COPY yarn.lock package.json .yarnrc ./
COPY patches patches
COPY solc_bin solc_bin
COPY .yarn .yarn
COPY operator_ui/package.json ./operator_ui/
COPY belt/package.json ./belt/
COPY belt/bin ./belt/bin
COPY evm-test-helpers/package.json ./evm-test-helpers/
COPY contracts/package.json ./contracts/
COPY tools/bin/restore-solc-cache ./tools/bin/restore-solc-cache
RUN make yarndep
COPY contracts ./contracts
COPY evm-test-helpers ./evm-test-helpers
COPY tsconfig.cjs.json tsconfig.es6.json ./
COPY operator_ui ./operator_ui
COPY belt ./belt
COPY belt/bin ./belt/bin
# Build operator-ui and the smart contracts
RUN make contracts-operator-ui-build
# Build the golang binary
FROM golang:1.16-buster
WORKDIR /chainlink
COPY GNUmakefile VERSION ./
COPY tools/bin/ldflags ./tools/bin/
# Env vars needed for chainlink build
ADD go.mod go.sum ./
RUN go mod download
# Env vars needed for chainlink build
ARG COMMIT_SHA
ARG ENVIRONMENT
COPY --from=0 /chainlink/operator_ui/dist ./operator_ui/dist
COPY core core
COPY packr packr
RUN make chainlink-build
# Final layer: ubuntu with chainlink binary
FROM ubuntu:18.04
ARG CHAINLINK_USER=root
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y ca-certificates wget gnupg lsb-release
# Install Postgres for CLI tools, needed specifically for DB backups
RUN wget --quiet -O - https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |tee /etc/apt/sources.list.d/pgdg.list \
&& apt-get update && apt-get install -y postgresql-client-13 \
&& apt-get clean all
COPY --from=1 /go/bin/chainlink /usr/local/bin/
RUN if [ ${CHAINLINK_USER} != root ]; then \
useradd --uid 14933 --create-home ${CHAINLINK_USER}; \
fi
USER ${CHAINLINK_USER}
WORKDIR /home/${CHAINLINK_USER}
EXPOSE 6688
ENTRYPOINT ["chainlink"]
CMD ["local", "node"]