Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
trinitys7 committed Sep 4, 2024
1 parent 3b26cde commit 1f64b04
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Dockerfile → consumer.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ COPY . /code
# then log output of file /code/bin/meshd
# then ensure static linking
RUN cd demo/ && LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build \
&& file /code/demo/build/meshd \
&& file /code/demo/build/meshconsumerd \
&& echo "Ensuring binary is statically linked ..." \
&& (file /code/demo/build/meshd | grep "statically linked")
&& (file /code/demo/build/meshconsumerd | grep "statically linked")

# --------------------------------------------------------
FROM alpine:3.17

COPY --from=go-builder /code/demo/build/meshd /usr/bin/meshd
COPY --from=go-builder /code/demo/build/meshconsumerd /usr/bin/meshconsumerd

# Install dependencies used for Starship
RUN apk add --no-cache curl make bash jq sed
Expand All @@ -38,4 +38,4 @@ WORKDIR /opt
# rest server, tendermint p2p, tendermint rpc
EXPOSE 1317 26656 26657

CMD ["/usr/bin/meshd", "version"]
CMD ["/usr/bin/meshconsumerd", "version"]
19 changes: 13 additions & 6 deletions demo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,30 @@ ifeq ($(OS),Windows_NT)
$(error mesh demo server not supported)
exit 1
else
go build -mod=readonly $(BUILD_FLAGS) -o $(BUILD_DIR)/$(APPNAME) ./cmd/meshd
go build -mod=readonly $(BUILD_FLAGS) -o $(BUILD_DIR)/meshconsumerd ./cmd/meshconsumerd
go build -mod=readonly $(BUILD_FLAGS) -o $(BUILD_DIR)/meshproviderd ./cmd/meshproviderd
endif

build-vendored:
go build -mod=vendor $(BUILD_FLAGS) -o $(BUILD_DIR)/$(APPNAME) ./cmd/meshd
go build -mod=vendor $(BUILD_FLAGS) -o $(BUILD_DIR)/meshconsumerd ./cmd/meshconsumerd
go build -mod=vendor $(BUILD_FLAGS) -o $(BUILD_DIR)/meshproviderd ./cmd/meshproviderd

build-linux-static:
go mod vendor # quick hack to make local dependencies work in Docker
mkdir -p $(BUILD_DIR)
docker build --tag osmosis/meshd:local ./
docker create --name meshd_temp osmosis/meshd:local
docker cp meshd_temp:/usr/bin/meshd $(BUILD_DIR)/
docker build --tag osmosis/meshconsumerd:local -f consumer.Dockerfile ./
docker build --tag osmosis/meshproviderd:local -f provider.Dockerfile ./
docker create --name meshd_temp osmosis/meshconsumerd:local
docker cp meshd_temp:/usr/bin/meshconsumerd $(BUILD_DIR)/
docker rm -f meshd_temp
docker create --name meshd_temp osmosis/meshproviderd:local
docker cp meshd_temp:/usr/bin/meshproviderd $(BUILD_DIR)/
docker rm -f meshd_temp
rm -rf vendor/

install:
go install -mod=readonly $(BUILD_FLAGS) ./cmd/meshd
go install -mod=readonly $(BUILD_FLAGS) ./cmd/meshconsumerd
go install -mod=readonly $(BUILD_FLAGS) ./cmd/meshproviderd

########################################
### Testing
Expand Down
2 changes: 1 addition & 1 deletion demo/app/consumer/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const appName = "MeshConsumerApp"

// We pull these out so we can set them with LDFLAGS in the Makefile
var (
NodeDir = ".meshd"
NodeDir = ".meshconsumerd"
Bech32Prefix = "mesh"
)

Expand Down
2 changes: 1 addition & 1 deletion demo/app/provider/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const appName = "MeshProviderApp"

// We pull these out so we can set them with LDFLAGS in the Makefile
var (
NodeDir = ".meshd"
NodeDir = ".meshproviderd"
Bech32Prefix = "mesh"
)

Expand Down
Loading

0 comments on commit 1f64b04

Please sign in to comment.