forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add docker file * makefile and minor fix --------- Co-authored-by: Vitalis Salis <vitsalis@gmail.com>
- Loading branch information
Showing
2 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
FROM golang:1.20.5-alpine as builder | ||
|
||
# Version to build. Default is the Git HEAD. | ||
ARG VERSION="HEAD" | ||
|
||
# Use muslc for static libs | ||
ARG BUILD_TAGS="muslc" | ||
|
||
|
||
RUN apk add --no-cache --update openssh git make build-base linux-headers libc-dev \ | ||
pkgconfig zeromq-dev musl-dev alpine-sdk libsodium-dev \ | ||
libzmq-static libsodium-static gcc | ||
|
||
|
||
RUN mkdir -p /root/.ssh && ssh-keyscan github.com >> /root/.ssh/known_hosts | ||
RUN git config --global url."git@github.com:".insteadOf "https://github.com/" | ||
ENV GOPRIVATE=github.com/babylonchain/babylon-private | ||
|
||
# Build | ||
WORKDIR /go/src/github.com/babylonchain/btc-validator | ||
# Cache dependencies | ||
COPY go.mod go.sum /go/src/github.com/babylonchain/btc-validator/ | ||
RUN --mount=type=secret,id=sshKey,target=/root/.ssh/id_rsa go mod download | ||
# Copy the rest of the files | ||
COPY ./ /go/src/github.com/babylonchain/btc-validator/ | ||
|
||
# Cosmwasm - Download correct libwasmvm version | ||
RUN WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | cut -d ' ' -f 2) && \ | ||
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$(uname -m).a \ | ||
-O /lib/libwasmvm_muslc.a && \ | ||
# verify checksum | ||
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \ | ||
sha256sum /lib/libwasmvm_muslc.a | grep $(cat /tmp/checksums.txt | grep libwasmvm_muslc.$(uname -m) | cut -d ' ' -f 1) | ||
|
||
RUN CGO_LDFLAGS="$CGO_LDFLAGS -lstdc++ -lm -lsodium" \ | ||
CGO_ENABLED=1 \ | ||
BUILD_TAGS=$BUILD_TAGS \ | ||
LINK_STATICALLY=true \ | ||
make build | ||
|
||
# FINAL IMAGE | ||
FROM alpine:3.16 AS run | ||
|
||
RUN addgroup --gid 1138 -S btcvalidator && adduser --uid 1138 -S btcvalidator -G btcvalidator | ||
|
||
RUN apk add bash curl jq | ||
|
||
COPY --from=builder /go/src/github.com/babylonchain/btc-validator/build/vald /bin/vald | ||
COPY --from=builder /go/src/github.com/babylonchain/btc-validator/build/valcli /bin/valcli | ||
|
||
WORKDIR /home/btcvalidator | ||
RUN chown -R btcvalidator /home/btcvalidator | ||
USER btcvalidator | ||
|
||
ENTRYPOINT ["/bin/vald"] | ||
CMD [] | ||
STOPSIGNAL SIGTERM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters