From 1d88049f9709507b221c986da95f002b038fd7b4 Mon Sep 17 00:00:00 2001 From: pengzhen Date: Thu, 5 Dec 2024 18:11:49 +0800 Subject: [PATCH] feat: add dockerfile --- Dockerfile | 17 +++++++++++++++++ Makefile | 2 +- internal/version/vcs.go | 4 ---- storage/pebble/storage.go | 2 +- storage/pebble/storage_test.go | 2 +- 5 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e65815f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM --platform=linux/amd64 golang:1.23 as builder + +WORKDIR /app + +COPY . . +RUN go env -w GOPROXY=https://goproxy.cn,direct +# RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build ./cmd/shisui/main.go +RUN make shisui + + +FROM --platform=linux/amd64 ubuntu:22.04 + +COPY --from=builder /app/build/bin/shisui /usr/local/bin/app + +EXPOSE 8545 9009/udp + +ENTRYPOINT [ "app" ] \ No newline at end of file diff --git a/Makefile b/Makefile index 16721c5..7e3fda6 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ shisui: #? shisui-image: Build shisui image shisui-image: - docker build -t ghcr.io/optimism-java/shisui:latest -f Dockerfile.portal . + docker build -t ghcr.io/optimism-java/shisui:latest -f Dockerfile . #? fmt: Ensure consistent code formatting. fmt: diff --git a/internal/version/vcs.go b/internal/version/vcs.go index 2e461a7..0bdbcb2 100644 --- a/internal/version/vcs.go +++ b/internal/version/vcs.go @@ -22,7 +22,6 @@ package version import ( - "fmt" "runtime/debug" "time" ) @@ -47,9 +46,6 @@ type VCSInfo struct { // VCS returns version control information of the current executable. func VCS() (VCSInfo, bool) { - fmt.Println("vcs") - fmt.Println(gitCommit) - fmt.Println(gitDate) if gitCommit != "" { // Use information set by the build script if present. return VCSInfo{Commit: gitCommit, Date: gitDate}, true diff --git a/storage/pebble/storage.go b/storage/pebble/storage.go index cac2911..177b6ab 100644 --- a/storage/pebble/storage.go +++ b/storage/pebble/storage.go @@ -1,4 +1,4 @@ -package ethpepple +package pepple import ( "bytes" diff --git a/storage/pebble/storage_test.go b/storage/pebble/storage_test.go index c420542..99799d0 100644 --- a/storage/pebble/storage_test.go +++ b/storage/pebble/storage_test.go @@ -1,4 +1,4 @@ -package ethpepple +package pepple import ( "testing"