forked from algorand/go-algorand
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
66 lines (51 loc) · 1.82 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
FROM ubuntu:20.04 as builder
ARG GO_VERSION="1.23.3"
ARG CHANNEL
ARG URL
ARG BRANCH
ARG SHA
ARG TARGETARCH
ADD https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz /go.tar.gz
# Basic dependencies.
ENV HOME="/node" DEBIAN_FRONTEND="noninteractive" GOPATH="/dist"
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
apt-utils \
bsdmainutils \
curl \
git \
&& rm -rf /var/lib/apt/lists/* && \
\
tar -C /usr/local -xzf /go.tar.gz && \
rm -rf /go.tar.gz
ENV PATH="/usr/local/go/bin:${PATH}"
COPY ./docker/files/ /dist/files
COPY ./installer/genesis /dist/files/run/genesis
COPY ./cmd/updater/update.sh /dist/files/build/update.sh
COPY ./installer/config.json.example /dist/files/run/config.json.example
# Install algod binaries.
RUN /dist/files/build/install.sh \
-p "${GOPATH}/bin" \
-d "/algod/data" \
-c "${CHANNEL}" \
-u "${URL}" \
-b "${BRANCH}" \
-s "${SHA}"
FROM debian:bookworm-20240311-slim as final
ENV PATH="/node/bin:${PATH}" ALGOD_PORT="8080" KMD_PORT="7833" ALGORAND_DATA="/algod/data"
# curl is needed to lookup the fast catchup url
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl && \
update-ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
mkdir -p "$ALGORAND_DATA" && \
groupadd --gid=999 --system algorand && \
useradd --uid=999 --no-log-init --create-home --system --gid algorand algorand && \
chown -R algorand:algorand /algod
COPY --chown=algorand:algorand --from=builder "/dist/bin/" "/node/bin/"
COPY --chown=algorand:algorand --from=builder "/dist/files/run/" "/node/run/"
# Expose Algod REST API, KMD REST API, Algod Gossip, and Prometheus Metrics ports
EXPOSE $ALGOD_PORT $KMD_PORT 4160 9100
WORKDIR /algod
CMD ["/node/run/run.sh"]