From ced1fbe55cce52e92c2f05eba23e5811d1932a0c Mon Sep 17 00:00:00 2001 From: beer-1 <147697694+beer-1@users.noreply.github.com> Date: Wed, 9 Oct 2024 10:54:39 +0900 Subject: [PATCH] fix docker file (#69) --- Dockerfile | 36 +++++++++++++++++++++++++----------- cmd/minitiad/config.go | 3 +++ 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5f3d2c6..afff48f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,32 @@ -FROM golang:1.22-bullseye AS go-builder +# Stage 1: Build the Go project +FROM golang:1.22-alpine3.19 AS go-builder -# Install minimum necessary dependencies, build Cosmos SDK, remove packages -RUN apt update -RUN apt install -y curl git build-essential ca-certificates -# debug: for live editting in the image -RUN apt install -y vim +# Use build arguments for the target architecture +ARG TARGETARCH +ARG GOARCH + +# Install necessary packages +RUN set -eux; apk add --no-cache ca-certificates build-base git cmake WORKDIR /code COPY . /code/ -RUN LEDGER_ENABLED=false make build +# Install mimalloc +RUN git clone --depth 1 https://github.com/microsoft/mimalloc; cd mimalloc; mkdir build; cd build; cmake ..; make -j$(nproc); make install +ENV MIMALLOC_RESERVE_HUGE_OS_PAGES=4 + +RUN LEDGER_ENABLED=false GOARCH=${GOARCH} LDFLAGS="-linkmode=external -extldflags \"-L/code/mimalloc/build -lmimalloc -Wl,-z,muldefs -static\"" make build + +FROM alpine:3.19 + +RUN addgroup minitia \ + && adduser -G minitia -D -h /minitia minitia -FROM ubuntu:20.04 +WORKDIR /minitia -WORKDIR /root +COPY --from=go-builder /code/build/minitiad /usr/local/bin/minitiad -COPY --from=go-builder /etc/ssl/certs /etc/ssl/certs -COPY --from=go-builder /code/build/minitiad /usr/local/bin/minitiad +USER minitia # rest server EXPOSE 1317 @@ -26,5 +36,9 @@ EXPOSE 9090 EXPOSE 26656 # tendermint rpc EXPOSE 26657 +# geth jsonrpc +EXPOSE 8545 +# geth jsonrpc ws +EXPOSE 8546 CMD ["/usr/local/bin/minitiad", "version"] diff --git a/cmd/minitiad/config.go b/cmd/minitiad/config.go index 6909c61..38ff154 100644 --- a/cmd/minitiad/config.go +++ b/cmd/minitiad/config.go @@ -61,6 +61,9 @@ func initAppConfig() (string, interface{}) { JSONRPCConfig: jsonrpcconfig.DefaultJSONRPCConfig(), } + minitiaAppConfig.JSONRPCConfig.Address = "0.0.0.0:8545" + minitiaAppConfig.JSONRPCConfig.AddressWS = "0.0.0.0:8546" + minitiaAppTemplate := serverconfig.DefaultConfigTemplate + evmconfig.DefaultConfigTemplate + indexerconfig.DefaultConfigTemplate +