-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Push changes to containerise Makefile
- Loading branch information
1 parent
4f6295a
commit e349541
Showing
8 changed files
with
865 additions
and
5,053 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# | ||
# Do not use directly, use `make docker-build-proto` instead | ||
# | ||
|
||
FROM golang:1.19 | ||
ENV GOPATH=/go | ||
WORKDIR ${GOPATH}/src/github.com/lib/px-api/ | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y clang-format unzip golang-grpc-gateway gogoprotobuf && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/protoc-3.14.0-linux-x86_64.zip | ||
RUN unzip protoc-3.14.0-linux-x86_64.zip -d /usr/local | ||
|
||
RUN curl -OL https://github.com/grpc-ecosystem/grpc-gateway/archive/refs/tags/v2.2.0.tar.gz | ||
RUN mkdir -p ${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/ && tar -xvf v2.2.0.tar.gz -C ${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/ --strip-components=1 && rm -f v2.2.0.tar.gz | ||
|
||
RUN git clone https://github.com/gogo/protobuf.git ${GOPATH}/src/github.com/gogo/protobuf | ||
|
||
COPY go.mod go.sum ${WORKDIR}/ | ||
|
||
RUN go get -u \ | ||
google.golang.org/protobuf \ | ||
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \ | ||
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,34 +17,13 @@ GO111MODULE := on | |
|
||
.DEFAULT_GOAL: all | ||
|
||
all: proto pretest | ||
|
||
centos: | ||
# Installation is specific for centos based distribution | ||
yum install -y centos-release-scl && yum install -y llvm-toolset-7 && yum makecache && yum install -y unzip | ||
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/$(PROTOC_ZIP) | ||
unzip -o $(PROTOC_ZIP) -d /usr bin/protoc | ||
rm -f $(PROTOC_ZIP) | ||
scl enable llvm-toolset-7 "clang-format -i $(PROTOC_FILES)" | ||
all: docker-build-proto | ||
|
||
docker-build-proto: | ||
docker build . -t px-api:1 | ||
docker run --rm -v ${PWD}:/go/src/github.com/lib/px-api px-api:1 /bin/bash -c "make proto pretest" | ||
|
||
proto: | ||
apt install clang-format | ||
rm -rf ${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/ | ||
mkdir -p ${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/ | ||
curl -OL https://github.com/grpc-ecosystem/grpc-gateway/archive/refs/tags/v2.2.0.tar.gz | ||
tar -xvf v2.2.0.tar.gz -C ${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/ --strip-components=1 | ||
rm -f v2.2.0.tar.gz | ||
|
||
rm -rf ${GOPATH}/src/github.com/gogo/protobuf/ | ||
mkdir -p ${GOPATH}/src/github.com/gogo/protobuf/ | ||
git clone [email protected]:gogo/protobuf.git ${GOPATH}/src/github.com/gogo/protobuf | ||
|
||
go get -u \ | ||
github.com/gogo/protobuf/protoc-gen-gogo \ | ||
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \ | ||
github.com/gogo/protobuf/protoc-gen-gogofaster \ | ||
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger | ||
$(PROTOC) -I/usr/local/include -I. \ | ||
-I${GOPATH}/src \ | ||
-I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-openapiv2 \ | ||
|
@@ -76,17 +55,16 @@ Mgoogle/api/annotations.proto=github.com/gogo/googleapis/google/api,\ | |
Mgoogle/protobuf/field_mask.proto=github.com/gogo/protobuf/types:.\ | ||
--swagger_out=logtostderr=true:. \ | ||
$(PROTOC_FILES) | ||
|
||
pretest: vet staticcheck errcheck | ||
pretest: vet staticcheck errcheck | ||
|
||
vet: | ||
go vet $(PKGS) | ||
|
||
staticcheck: | ||
GOFLAGS="" go install honnef.co/go/tools/cmd/staticcheck@v0.2.2 | ||
GOFLAGS="" go install honnef.co/go/tools/cmd/staticcheck@latest | ||
staticcheck $(PKGS) | ||
|
||
errcheck: | ||
go get -u github.com/kisielk/errcheck | ||
go install github.com/kisielk/errcheck@latest | ||
errcheck -ignoregenerated -verbose -blank $(PKGS) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.