-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
77 lines (58 loc) · 2.06 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
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
# Use official golang image as base
# OS for building doctor and kava binaries
ARG go_builder_image=golang:1.18.3
FROM $go_builder_image as go-builder
# Install packages needed to build the golang binaries
RUN apt-get update \
&& apt-get install -y git make gcc \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir /app
WORKDIR /app
# Download and build kava from remote sources
ARG kava_node_version=v0.17.5
ENV KAVA_NODE_VERSION=$kava_node_version
RUN git clone https://github.com/kava-labs/kava \
&& cd kava \
&& git checkout $KAVA_NODE_VERSION \
&& make install
# Copy over local sources
# and build the doctor binary
RUN mkdir /app/doctor
WORKDIR /app/doctor
COPY Makefile ./
COPY *.go go.mod go.sum ./
COPY clients/ clients/
COPY collect/ collect/
COPY metric/ metric/
COPY heal/ heal/
COPY config/ config/
COPY .env ./
RUN make install
# Copy over configuration and scripts
# for running kava and doctor services
COPY docker/ ./
# Use a mimimial production like base
# image for running kava and doctor services
FROM ubuntu:jammy
RUN apt-get update \
&& apt-get install -y supervisor curl \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir /app \
&& mkdir /app/bin
WORKDIR /app
# update path for docker user to include
# kava and doctor binaries
ENV PATH=$PATH:/app/bin
# copy build binaries from build environment
COPY --from=go-builder /go/bin/kava /app/bin/kava
COPY --from=go-builder /go/bin/doctor /app/bin/doctor
# copy config templates to automate setup
COPY --from=go-builder /app/doctor/chain-configs /app/templates
COPY --from=go-builder /app/doctor/doctor-config/config.json /root/.kava/doctor/config.json
# copy scripts to run services
COPY --from=go-builder /app/doctor/supervisord/start-services.sh /app/bin/start-services.sh
COPY --from=go-builder /app/doctor/supervisord/kill-supervisord.sh /app/bin/kill-supervisord.sh
COPY --from=go-builder /app/doctor/supervisord/supervisord.conf /etc/supervisor/conf.d/doctor.conf
# by default start kava and doctor services
# using the configuration in /app/templates
CMD ["/app/bin/start-services.sh"]