forked from erigontech/erigon
-
Notifications
You must be signed in to change notification settings - Fork 44
/
Dockerfile.release
93 lines (71 loc) · 3.13 KB
/
Dockerfile.release
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
82
83
84
85
86
87
88
89
90
91
92
93
ARG RELEASE_DOCKER_BASE_IMAGE="alpine:3.20.1" \
CI_CD_MAIN_BUILDER_IMAGE="golang:1.22-bookworm" \
CI_CD_MAIN_TARGET_BASE_IMAGE="alpine:3.20.1" \
EXPOSED_PORTS="8545 \
8551 \
8546 \
30303 \
30303/udp \
42069 \
42069/udp \
8080 \
9090 \
6060"
## Note TARGETARCH is a crucial variable:
## see https://docs.docker.com/reference/dockerfile/#automatic-platform-args-in-the-global-scope
### Release Dockerfile
FROM ${RELEASE_DOCKER_BASE_IMAGE} AS temporary
ARG TARGETARCH \
TARGETVARIANT \
VERSION=${VERSION} \
APPLICATION
COPY ./dist/${APPLICATION}_${VERSION}_linux_${TARGETARCH}${TARGETVARIANT}.tar.gz /tmp/${APPLICATION}.tar.gz
RUN tar xzvf /tmp/${APPLICATION}.tar.gz -C /tmp && \
mv /tmp/${APPLICATION}_${VERSION}_linux_${TARGETARCH}${TARGETVARIANT} /tmp/${APPLICATION}
FROM ${RELEASE_DOCKER_BASE_IMAGE} AS release
ARG USER=erigon \
GROUP=erigon \
APPLICATION \
EXPOSED_PORTS
RUN --mount=type=bind,from=temporary,source=/tmp/${APPLICATION},target=/tmp/${APPLICATION} \
apk add --no-cache ca-certificates tzdata && \
addgroup ${GROUP} && \
adduser -D -h /home/${USER} -G ${GROUP} ${USER} && \
install -d -o ${USER} -g ${GROUP} /home/${USER}/.local /home/${USER}/.local/share /home/${USER}/.local/share/erigon && \
install -o ${USER} -g ${GROUP} /tmp/${APPLICATION}/erigon /usr/local/bin/ && \
install -o ${USER} -g ${GROUP} /tmp/${APPLICATION}/integration /usr/local/bin/ && \
install -o ${USER} -g ${GROUP} /tmp/${APPLICATION}/diag /usr/local/bin/ && \
install -o ${USER} -g ${GROUP} /tmp/${APPLICATION}/sentry /usr/local/bin/ && \
install -o ${USER} -g ${GROUP} /tmp/${APPLICATION}/txpool /usr/local/bin/ && \
install -o ${USER} -g ${GROUP} /tmp/${APPLICATION}/downloader /usr/local/bin/ && \
install -o ${USER} -g ${GROUP} /tmp/${APPLICATION}/rpcdaemon /usr/local/bin/
VOLUME [ "/home/${USER}" ]
WORKDIR /home/${USER}
USER ${USER}
EXPOSE ${EXPOSED_PORTS}
ENTRYPOINT [ "/usr/local/bin/erigon" ]
### End of Release Dockerfile
### CI-CD : main branch docker image publishing for each new commit id
FROM ${CI_CD_MAIN_BUILDER_IMAGE} AS ci-cd-main-branch-builder
COPY /build-amd64 /build-amd64/
COPY /build-arm64 /build-arm64/
RUN echo "DEBUG: content of build-amd64" && ls -l /build-amd64 && \
echo && \
echo "DEBUG: content of build-arm64" && ls -l /build-arm64
FROM ${CI_CD_MAIN_TARGET_BASE_IMAGE} AS ci-cd-main-branch
ARG USER=erigon \
GROUP=erigon \
TARGETARCH \
EXPOSED_PORTS
RUN --mount=type=bind,from=ci-cd-main-branch-builder,source=/build-${TARGETARCH},target=/tmp/erigon \
apk add --no-cache ca-certificates tzdata libstdc++ && \
addgroup ${GROUP} && \
adduser -D -h /home/${USER} -G ${GROUP} ${USER} && \
install -d -o ${USER} -g ${GROUP} /home/${USER}/.local /home/${USER}/.local/share /home/${USER}/.local/share/erigon && \
install -o ${USER} -g ${GROUP} /tmp/erigon/* /usr/local/bin/
VOLUME [ "/home/${USER}" ]
WORKDIR /home/${USER}
USER ${USER}
EXPOSE ${EXPOSED_PORTS}
ENTRYPOINT [ "/usr/local/bin/erigon" ]
### End of CI-CD : main branch docker image publishing for each new commit id