-
Notifications
You must be signed in to change notification settings - Fork 73
/
Dockerfile.upgrade
81 lines (63 loc) · 2.22 KB
/
Dockerfile.upgrade
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
79
80
81
FROM golang:1.22-bookworm AS builder
ENV GO111MODULE=on
ENV GOMODCACHE=/gocache
ENV BASELINE_VERSION_TAG=v0.6.6
ENV UPGRADE_VERSION_TAG=v0.7.0
ENV GIT_STASH_MESSAGE="Docker build"
ADD . /src
WORKDIR /src
# Save the uncommited changes
RUN git stash -u -m "$GIT_STASH_MESSAGE"
# Switch to the baseline version
RUN git checkout $BASELINE_VERSION_TAG
# Build the baseline version
RUN mkdir -p $GOMODCACHE
RUN --mount=type=cache,target=/gocache \
--mount=type=cache,target=/root/.cache/go-build \
go install cosmossdk.io/tools/cosmovisor/cmd/[email protected]
RUN --mount=type=cache,target=/gocache \
--mount=type=cache,target=/root/.cache/go-build \
make install
# Restore the current version
RUN git switch -
RUN sh -c 'git stash list | grep "$GIT_STASH_MESSAGE" && git stash pop'; true
# Build the current version
RUN --mount=type=cache,target=/gocache \
--mount=type=cache,target=/root/.cache/go-build \
make build-local-edits
RUN cp build/allorad /go/bin/allorad-$UPGRADE_VERSION_TAG
#==============================================================
FROM debian:bookworm-slim as execution
ENV DEBIAN_FRONTEND=noninteractive \
USERNAME=appuser \
APP_PATH=/data
#* curl jq - required for readyness probe and to download genesis
#* bc - required for generate_genesis.sh
RUN apt update && \
apt -y dist-upgrade && \
apt install -y --no-install-recommends \
curl jq \
tzdata \
bc \
ca-certificates && \
echo "deb http://deb.debian.org/debian testing main" >> /etc/apt/sources.list && \
apt update && \
apt install -y --no-install-recommends -t testing \
zlib1g \
libgnutls30 \
perl-base && \
rm -rf /var/cache/apt/*
#* Install dasel to work with json/yaml/toml configs
ENV DASEL_VERSION="v2.8.1"
ADD https://github.com/TomWright/dasel/releases/download/${DASEL_VERSION}/dasel_linux_amd64 /usr/local/bin/dasel
RUN chmod a+x /usr/local/bin/dasel
COPY --from=builder /go/bin/* /usr/local/bin/
RUN groupadd -g 1001 ${USERNAME} \
&& useradd -m -d ${APP_PATH} -u 1001 -g 1001 ${USERNAME}
EXPOSE 1317 26656 26657
VOLUME ${APP_PATH}
WORKDIR ${APP_PATH}
USER ${USERNAME}
ENV DAEMON_NAME="allorad"
ENV DAEMON_HOME="/data"
ENTRYPOINT ["cosmovisor" "run" "start"]