From 0aa8feeb0026eb471764b5419eabef3db126c923 Mon Sep 17 00:00:00 2001 From: Victor Castell Date: Fri, 5 Nov 2021 16:46:59 +0100 Subject: [PATCH 1/5] Apply best practices to Dockerfile --- Dockerfile | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index c03cfacad8..860b18c704 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,27 @@ # Build Geth in a stock Go builder container FROM golang:1.17-alpine as builder -RUN apk add --no-cache make gcc musl-dev linux-headers git bash +RUN set -x \ + && buildDeps='bash build-base musl-dev linux-headers git' \ + && apk add --update $buildDeps \ + && rm -rf /var/cache/apk/* \ + && mkdir -p /bor -ADD . /bor -RUN cd /bor && make bor-all +WORKDIR /bor +COPY . . +RUN make bor-all CMD ["/bin/bash"] # Pull Bor into a second stage deploy alpine container -FROM alpine:latest +FROM alpine:3.14 + +RUN set -x \ + && apk add --update --no-cache \ + ca-certificates \ + && rm -rf /var/cache/apk/* -RUN apk add --no-cache ca-certificates COPY --from=builder /bor/build/bin/bor /usr/local/bin/ COPY --from=builder /bor/build/bin/bootnode /usr/local/bin/ -EXPOSE 8545 8546 8547 30303 30303/udp \ No newline at end of file +EXPOSE 8545 8546 8547 30303 30303/udp From 57898e43e17b7058e05ad9683a7ee1e1370d5ddc Mon Sep 17 00:00:00 2001 From: Victor Castell Date: Wed, 10 Nov 2021 11:02:37 +0100 Subject: [PATCH 2/5] Final touches to Dockerfiles --- Dockerfile | 2 ++ Dockerfile.alltools | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 860b18c704..c12a8b1f4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,3 +25,5 @@ COPY --from=builder /bor/build/bin/bor /usr/local/bin/ COPY --from=builder /bor/build/bin/bootnode /usr/local/bin/ EXPOSE 8545 8546 8547 30303 30303/udp + +ENTRYPOINT ["bor"] diff --git a/Dockerfile.alltools b/Dockerfile.alltools index 10cf1392e7..53be8bc950 100644 --- a/Dockerfile.alltools +++ b/Dockerfile.alltools @@ -9,7 +9,10 @@ RUN cd /bor && make bor-all # Pull all binaries into a second stage deploy alpine container FROM alpine:latest -RUN apk add --no-cache ca-certificates +RUN set -x \ + && apk add --update --no-cache \ + ca-certificates \ + && rm -rf /var/cache/apk/* COPY --from=builder /bor/build/bin/* /usr/local/bin/ -EXPOSE 8545 8546 30303 30303/udp \ No newline at end of file +EXPOSE 8545 8546 30303 30303/udp From e58bdfa8e8ac96f4aaf6d3911af5001596ea4e82 Mon Sep 17 00:00:00 2001 From: Victor Castell Date: Wed, 10 Nov 2021 11:31:23 +0100 Subject: [PATCH 3/5] Build the new CLI --- Dockerfile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index c12a8b1f4e..37f0182bdc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,9 +9,7 @@ RUN set -x \ WORKDIR /bor COPY . . -RUN make bor-all - -CMD ["/bin/bash"] +RUN go build -o ./build/bin/bor ./command # Pull Bor into a second stage deploy alpine container FROM alpine:3.14 @@ -22,7 +20,6 @@ RUN set -x \ && rm -rf /var/cache/apk/* COPY --from=builder /bor/build/bin/bor /usr/local/bin/ -COPY --from=builder /bor/build/bin/bootnode /usr/local/bin/ EXPOSE 8545 8546 8547 30303 30303/udp From 8ce30321ad46fabb3e3f991794dd028aa84d4f3c Mon Sep 17 00:00:00 2001 From: Victor Castell Date: Wed, 10 Nov 2021 11:31:39 +0100 Subject: [PATCH 4/5] Bump Go --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b55bfbdccb..b1badac12e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,9 +6,9 @@ jobs: steps: - uses: actions/checkout@v2 - name: Install Go - uses: actions/setup-go@v2.1.3 + uses: actions/setup-go@v2 with: - go-version: 1.16.7 + go-version: 1.17 - name: "Build binaries" run: make all - name: "Run tests" From ba25f8447aa0735c1c3e878611c1d53e7d98bf6d Mon Sep 17 00:00:00 2001 From: Victor Castell Date: Wed, 10 Nov 2021 12:07:54 +0100 Subject: [PATCH 5/5] Revert "Build the new CLI" This reverts commit e58bdfa8e8ac96f4aaf6d3911af5001596ea4e82. --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 37f0182bdc..c12a8b1f4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,9 @@ RUN set -x \ WORKDIR /bor COPY . . -RUN go build -o ./build/bin/bor ./command +RUN make bor-all + +CMD ["/bin/bash"] # Pull Bor into a second stage deploy alpine container FROM alpine:3.14 @@ -20,6 +22,7 @@ RUN set -x \ && rm -rf /var/cache/apk/* COPY --from=builder /bor/build/bin/bor /usr/local/bin/ +COPY --from=builder /bor/build/bin/bootnode /usr/local/bin/ EXPOSE 8545 8546 8547 30303 30303/udp