Build & docker updates

Gitea token is no longer needed
This commit is contained in:
Roy Crihfield 2024-03-28 18:09:04 +08:00
parent 6b780827a7
commit 01237ea78f
3 changed files with 14 additions and 9 deletions

View File

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

View File

@ -1,5 +1,6 @@
# Using the same base golang image as plugeth # Using image with same alpine as plugeth,
FROM golang:1.20-alpine3.18 as builder # 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 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 ARG GIT_VDBTO_TOKEN
# Get and cache deps # Get and cache deps
WORKDIR /plugeth-statediff/ WORKDIR /plugeth-statediff
COPY go.mod go.sum ./ 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 && \ RUN go mod download
go mod download && \
rm -f ~/.gitconfig
COPY . . COPY . .
RUN go build --tags linkgeth --buildmode=plugin --trimpath -o statediff.so ./main RUN go build --tags linkgeth --buildmode=plugin --trimpath -o statediff.so ./main

View File

@ -1,5 +1,6 @@
MOCKGEN ?= mockgen MOCKGEN ?= mockgen
MOCKS_DIR := $(CURDIR)/test_helpers/mocks MOCKS_DIR := $(CURDIR)/test_helpers/mocks
BUILD_DIR ?= ./build
mocks: $(MOCKS_DIR)/gen_backend.go mocks: $(MOCKS_DIR)/gen_backend.go
.PHONY: mocks .PHONY: mocks
@ -16,8 +17,8 @@ docker-image: mocks
# Local build # Local build
BUILD_FLAGS := --trimpath BUILD_FLAGS := --trimpath
plugin: build/statediff.so plugin: $(BUILD_DIR)/lib/statediff.so
.PHONY: plugin .PHONY: plugin
build/statediff.so: ./**/*.go $(BUILD_DIR)/lib/statediff.so: ./**/*.go
go build --tags linkgeth --buildmode=plugin -o $@ $(BUILD_FLAGS) ./main go build --tags linkgeth --buildmode=plugin -o $@ $(BUILD_FLAGS) ./main