diff --git a/.dockerignore b/.dockerignore index 7586590..c962ed1 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,8 @@ +Dockerfile .git +Makefile +scripts **/*_test.go -*.so +**/*.so +test +build \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 9b3ed2c..655f9d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ -# Using the same base golang image as plugeth -FROM golang:1.20-alpine3.18 as builder +# Using image with same alpine as plugeth, +# but go 1.21 to evade https://github.com/Consensys/gnark-crypto/issues/468 +FROM golang:1.21-alpine3.18 as builder RUN apk add --no-cache gcc musl-dev binutils-gold linux-headers git @@ -7,11 +8,9 @@ RUN apk add --no-cache gcc musl-dev binutils-gold linux-headers git ARG GIT_VDBTO_TOKEN # Get and cache deps -WORKDIR /plugeth-statediff/ +WORKDIR /plugeth-statediff COPY go.mod go.sum ./ -RUN if [ -n "$GIT_VDBTO_TOKEN" ]; then git config --global url."https://$GIT_VDBTO_TOKEN:@git.vdb.to/".insteadOf "https://git.vdb.to/"; fi && \ - go mod download && \ - rm -f ~/.gitconfig +RUN go mod download COPY . . RUN go build --tags linkgeth --buildmode=plugin --trimpath -o statediff.so ./main diff --git a/Makefile b/Makefile index afb3de9..dc50caa 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ MOCKGEN ?= mockgen MOCKS_DIR := $(CURDIR)/test_helpers/mocks +BUILD_DIR ?= ./build mocks: $(MOCKS_DIR)/gen_backend.go .PHONY: mocks @@ -16,8 +17,8 @@ docker-image: mocks # Local build BUILD_FLAGS := --trimpath -plugin: build/statediff.so +plugin: $(BUILD_DIR)/lib/statediff.so .PHONY: plugin -build/statediff.so: ./**/*.go +$(BUILD_DIR)/lib/statediff.so: ./**/*.go go build --tags linkgeth --buildmode=plugin -o $@ $(BUILD_FLAGS) ./main