Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Dockerfile.proto-gen
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM tendermintdev/sdk-proto-gen:v0.7

ENV GOLANG_VERSION=1.21.0
ENV PATH=/usr/local/go/bin:$PATH

RUN wget -q "https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz" && \
tar -C /usr/local -xzf "go${GOLANG_VERSION}.linux-amd64.tar.gz" && \
rm "go${GOLANG_VERSION}.linux-amd64.tar.gz" && \
go version
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,32 @@ go.sum: go.mod

test:
@go test -mod=readonly $(PACKAGES)

###############################################################################
### Proto ###
###############################################################################

# Variables for the image and version
protoVer=v0.7
protoImageName=tendermintdev/sdk-proto-gen-go-1.21-image
GOLANG_VERSION=1.21.0
containerProtoGen=firmachain-proto-gen-$(protoVer)-go-${GOLANG_VERSION}

# Target to build the image if it doesn't exist
build-proto-image:
@if [ -z "$$(docker images -q $(protoImageName))" ]; then \
echo "Building Docker image with Go $(GOLANG_VERSION)..."; \
docker build -t $(protoImageName) -f Dockerfile.proto-gen .; \
else \
echo "Image $(protoImageName) already exists."; \
fi

# Generate Protobuf files using the image
proto-gen: build-proto-image
@echo "Generating Protobuf files..."
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGen}$$"; then \
docker start -a $(containerProtoGen); \
else \
docker run --name $(containerProtoGen) -v $(CURDIR):/firmachain --workdir /firmachain $(protoImageName) \
sh ./scripts/protocgen.sh; \
fi
Loading