2023-06-14 13:03:01 +00:00
|
|
|
# Using the same base golang image as geth
|
|
|
|
FROM golang:1.20-alpine as builder
|
|
|
|
|
|
|
|
RUN apk add --no-cache gcc musl-dev binutils-gold linux-headers git
|
|
|
|
|
2023-07-06 20:05:53 +00:00
|
|
|
# Configure creds for gitea
|
2023-07-06 20:05:13 +00:00
|
|
|
ARG GITEA_TOKEN
|
|
|
|
ENV GITEA_TOKEN=$GITEA_TOKEN
|
2023-07-01 11:14:49 +00:00
|
|
|
|
2023-06-14 13:03:01 +00:00
|
|
|
# Get and cache deps
|
2023-07-06 20:07:35 +00:00
|
|
|
WORKDIR /plugeth-statediff/
|
|
|
|
COPY go.mod .
|
|
|
|
COPY go.sum .
|
2023-07-06 20:05:13 +00:00
|
|
|
RUN if [ -n "$GITEA_TOKEN" ]; then git config --global url."https://$GITEA_TOKEN:@git.vdb.to/".insteadOf "https://git.vdb.to/"; fi && \
|
2023-07-06 19:52:36 +00:00
|
|
|
go mod download && \
|
|
|
|
rm -f ~/.gitconfig
|
2023-06-14 13:03:01 +00:00
|
|
|
|
2023-07-06 20:08:21 +00:00
|
|
|
ADD . .
|
|
|
|
RUN go build --tags linkgeth --buildmode=plugin --trimpath -o statediff.so ./main
|
2023-06-14 13:03:01 +00:00
|
|
|
|
2023-07-06 19:52:36 +00:00
|
|
|
FROM alpine:3.18
|
2023-06-14 13:03:01 +00:00
|
|
|
|
|
|
|
COPY --from=builder /plugeth-statediff/statediff.so /usr/local/lib/
|