-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f998c0a
Showing
90 changed files
with
5,966 additions
and
0 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,2 @@ | ||
.gitignore | ||
Dockerfile |
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,21 @@ | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
# IDE | ||
.vscode | ||
|
||
# don't commit the service binary to vcs | ||
cartservice |
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,38 @@ | ||
FROM golang:1.19.0-alpine AS builder | ||
|
||
# Set Go env | ||
ENV CGO_ENABLED=0 GOOS=linux | ||
WORKDIR /go/src/hipstershop | ||
|
||
# Install dependencies | ||
RUN apk --update --no-cache add ca-certificates make protoc | ||
|
||
# Download grpc_health_probe | ||
RUN GRPC_HEALTH_PROBE_VERSION=v0.4.11 && \ | ||
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \ | ||
chmod +x /bin/grpc_health_probe | ||
|
||
# Build Go binary | ||
COPY Makefile go.mod go.sum ./ | ||
RUN go env -w GOPROXY=https://goproxy.io,direct/ | ||
RUN make init && go mod download | ||
COPY . . | ||
RUN make proto tidy | ||
|
||
# Skaffold passes in debug-oriented compiler flags | ||
ARG SKAFFOLD_GO_GCFLAGS | ||
RUN go build -gcflags="${SKAFFOLD_GO_GCFLAGS}" -o /go/src/hipstershop/cartservice . | ||
|
||
# Deployment container | ||
FROM scratch | ||
|
||
# Definition of this variable is used by 'skaffold debug' to identify a golang binary. | ||
# Default behavior - a failure prints a stack trace for the current goroutine. | ||
# See https://golang.org/pkg/runtime/ | ||
ENV GOTRACEBACK=single | ||
|
||
COPY --from=builder /etc/ssl/certs /etc/ssl/certs | ||
COPY --from=builder /bin/grpc_health_probe /bin/ | ||
COPY --from=builder /go/src/hipstershop/cartservice /hipstershop/cartservice | ||
|
||
ENTRYPOINT ["/hipstershop/cartservice"] |
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,33 @@ | ||
GOPATH:=$(shell go env GOPATH) | ||
|
||
.PHONY: init | ||
init: | ||
@go get -u google.golang.org/protobuf/proto | ||
@go install github.com/golang/protobuf/protoc-gen-go@latest | ||
@go install github.com/go-micro/generator/cmd/protoc-gen-micro@latest | ||
|
||
.PHONY: proto | ||
proto: | ||
@protoc --proto_path=. --micro_out=. --go_out=:. proto/cartservice.proto | ||
@protoc --proto_path=. --micro_out=. --go_out=:. proto/health.proto | ||
|
||
|
||
.PHONY: update | ||
update: | ||
@go get -u | ||
|
||
.PHONY: tidy | ||
tidy: | ||
@go mod tidy | ||
|
||
.PHONY: build | ||
build: | ||
@go build -o cartservice *.go | ||
|
||
.PHONY: test | ||
test: | ||
@go test -v ./... -cover | ||
|
||
.PHONY: docker | ||
docker: | ||
@docker build -t kurtosistech/obd-cartservice:latest . |
Oops, something went wrong.