Skip to content

Commit

Permalink
rebuild Dockerfile for multi-arch builds
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Sep 20, 2023
1 parent 70dcd3e commit d791db6
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@ FROM golang:1.20 AS build-env
COPY go.mod go.sum /src/
WORKDIR /src
RUN go mod download
ADD . /src
ARG target=linux
COPY . .
ARG TARGETOS
ARG TARGETARCH
ARG release=
ENV RELEASE=$release
RUN make $target
RUN <<EOR
VERSION=$(git rev-parse --short HEAD)
BUILDTIME=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
RELEASE=$release
CGO_ENABLED=1 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /bin/dora-explorer -ldflags="-s -w -X 'github.com/pk910/light-beaconchain-explorer/utils.BuildVersion=${VERSION}' -X 'github.com/pk910/light-beaconchain-explorer/utils.BuildRelease=${RELEASE}' -X 'github.com/pk910/light-beaconchain-explorer/utils.Buildtime=${BUILDTIME}'" ./cmd/explorer
EOR

# final stage
FROM debian:stable-slim
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates
RUN update-ca-certificates
COPY --from=build-env /src/bin/explorer_linux_amd64 /app
COPY --from=build-env /src/config /app/config
COPY --from=build-env /bin/dora-explorer /app
EXPOSE 8080
ENTRYPOINT ["./explorer_linux_amd64"]
CMD ["-config=./config/default.config.yml"]
ENTRYPOINT ["./dora-explorer"]
CMD []

0 comments on commit d791db6

Please sign in to comment.