Skip to content

Commit 9181722

Browse files
committed
A request collector
places received requests into a queue for executor servers this comes together fairly quickly based on everything learned from the creation of the executor and the demo-client.
1 parent c101410 commit 9181722

File tree

6 files changed

+538
-0
lines changed

6 files changed

+538
-0
lines changed

Dockerfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Use the official Golang image to create a build artifact.
2+
# This is based on Debian and sets the GOPATH to /go.
3+
# https://hub.docker.com/_/golang
4+
FROM golang:1.13 as builder
5+
6+
# Create and change to the app directory.
7+
WORKDIR /app
8+
9+
# Retrieve application dependencies using go modules.
10+
# Allows container builds to reuse downloaded dependencies.
11+
ARG user
12+
ARG personal_access_token
13+
RUN echo "machine github.com login ${user} password ${personal_access_token}" > ~/.netrc
14+
RUN GOPRIVATE=github.com/moraisworkrunner
15+
COPY go.* ./
16+
RUN go mod download
17+
18+
# Copy local code to the container image.
19+
COPY . ./
20+
21+
# Build the binary.
22+
# -mod=readonly ensures immutable go.mod and go.sum in container builds.
23+
RUN CGO_ENABLED=0 GOOS=linux go build -v -o server
24+
25+
# Use the official Alpine image for a lean production container.
26+
# https://hub.docker.com/_/alpine
27+
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
28+
FROM alpine:3
29+
RUN apk add --no-cache ca-certificates
30+
31+
# Copy the binary to the production image from the builder stage.
32+
COPY --from=builder /app/server /server
33+
34+
# Run the web service on container startup.
35+
CMD ["/server"]

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,22 @@
11
# collector
2+
23
Collects work requests and queues them to be executed
4+
5+
## build and Run
6+
7+
```bash
8+
go build
9+
./collector
10+
```
11+
12+
## docker build
13+
14+
```bash
15+
docker build -t ${GCP_GCR_HOSTNAME}/${GCP_PROJECT_ID}/collector:{VERSION} -f Dockerfile . --build-arg user=${user} --build-arg personal_access_token=${personal_access_token}
16+
```
17+
18+
## docker push
19+
20+
```bash
21+
docker push ${GCP_GCR_HOSTNAME}/${GCP_PROJECT_ID}/collector:{VERSION}
22+
```

go.mod

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module github.com/moraisworkrunner/collector
2+
3+
go 1.13
4+
5+
require (
6+
cloud.google.com/go v0.65.0
7+
github.com/moraisworkrunner/work-messages v0.0.0-20200901020349-70f9c3a9d8ac
8+
google.golang.org/genproto v0.0.0-20200831141814-d751682dd103
9+
)

0 commit comments

Comments
 (0)