Build & docker updates

This commit is contained in:
Roy Crihfield 2024-03-28 18:09:04 +08:00
parent 6b780827a7
commit 87a450797a
3 changed files with 13 additions and 6 deletions

View File

@ -1,3 +1,8 @@
Dockerfile
.git
Makefile
scripts
**/*_test.go
*.so
**/*.so
test
build

View File

@ -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,7 +8,7 @@ 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 && \

View File

@ -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