From ccb517bf61b44255dee72271cb0fa65077ac12b9 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Wed, 14 Jun 2023 21:03:01 +0800 Subject: [PATCH] dockerfile, .gitignore --- .dockerignore | 3 +++ .gitignore | 1 + Dockerfile | 17 +++++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7586590 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.git +**/*_test.go +*.so diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f1fe8d1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.so \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..62a4407 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +# 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 + +# Get and cache deps +COPY go.mod /plugeth-statediff/ +COPY go.sum /plugeth-statediff/ +RUN cd /plugeth-statediff && go mod download + +ADD . /plugeth-statediff +RUN cd /plugeth-statediff && \ + go build --tags linkgeth --buildmode=plugin --trimpath -o statediff.so ./main + +FROM alpine:latest + +COPY --from=builder /plugeth-statediff/statediff.so /usr/local/lib/