Skip to content

Commit

Permalink
Merge pull request ethereum#227 from maticnetwork/victor/pos-48-refac…
Browse files Browse the repository at this point in the history
…tor-bor-dockerfile

Apply best practices to Dockerfile
  • Loading branch information
vcastellm authored Nov 11, 2021
2 parents 2191490 + ba25f84 commit 5d0f0b7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
23 changes: 17 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
# 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
EXPOSE 8545 8546 8547 30303 30303/udp

ENTRYPOINT ["bor"]
7 changes: 5 additions & 2 deletions Dockerfile.alltools
Original file line number Diff line number Diff line change
Expand Up @@ -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
EXPOSE 8545 8546 30303 30303/udp

0 comments on commit 5d0f0b7

Please sign in to comment.