Merge pull request #227 from maticnetwork/victor/pos-48-refactor-bor-dockerfile

Apply best practices to Dockerfile
This commit is contained in:
Victor Castell 2021-11-11 11:03:32 +01:00 committed by GitHub
commit 5d0f0b70bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 10 deletions

View file

@ -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"

View file

@ -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"]

View file

@ -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