File tree 6 files changed +628
-23
lines changed
6 files changed +628
-23
lines changed Original file line number Diff line number Diff line change
1
+ name : Build and Push
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - master
7
+
8
+ env :
9
+ CLUSTER_NAME : titans-cluster
10
+ GCP_PROJECT : playground-369107
11
+ IMAGE_URL : europe-west1-docker.pkg.dev/playground-369107/ops/hack
12
+ DOCKER_BUILDKIT : 1
13
+
14
+ jobs :
15
+ setup-build-publish :
16
+ name : Setup, Build, Publish
17
+ runs-on : ubuntu-latest
18
+ steps :
19
+ - name : Checkout
20
+ uses : actions/checkout@v3
21
+
22
+ - id : ' auth'
23
+ uses : ' google-github-actions/auth@v1'
24
+ with :
25
+ credentials_json : ' ${{ secrets.GCP_CREDENTIALS }}'
26
+
27
+ # Setup gcloud CLI
28
+ - name : ' Setup Cloud SDK'
29
+ uses : ' google-github-actions/setup-gcloud@v1'
30
+
31
+ # Configure Docker to use the gcloud command-line tool as a credential helper for authentication
32
+ - run : |-
33
+ gcloud auth configure-docker europe-west1-docker.pkg.dev
34
+ # Build the Docker image
35
+ - name : Build
36
+ run : |-
37
+ docker build \
38
+ --tag "$IMAGE_URL:$GITHUB_SHA" \
39
+ --build-arg GITHUB_SHA="$GITHUB_SHA" \
40
+ --build-arg GITHUB_REF="$GITHUB_REF" \
41
+ .
42
+ # Push the Docker image to Google Container Registry
43
+ - name : Publish
44
+ run : |-
45
+ docker push "$IMAGE_URL:$GITHUB_SHA"
Original file line number Diff line number Diff line change
1
+ .idea
Original file line number Diff line number Diff line change 1
- FROM golang:1.19 as builder
2
- WORKDIR /code
3
-
4
- COPY main.go .
5
- COPY go.mod .
6
- COPY go.sum .
7
- RUN go mod download
8
-
9
- COPY *.go ./
10
-
11
- # `skaffold debug` sets SKAFFOLD_GO_GCFLAGS to disable compiler optimizations
12
- ARG SKAFFOLD_GO_GCFLAGS
13
- RUN go build -gcflags="${SKAFFOLD_GO_GCFLAGS}" -trimpath -o /app main.go
14
-
15
- FROM gcr.io/distroless/base-debian10
16
- # Define GOTRACEBACK to mark this container as using the Go language runtime
17
- # for `skaffold debug` (https://skaffold.dev/docs/workflows/debug/).
18
- ENV GOTRACEBACK=single
19
- EXPOSE 80
20
- CMD ["./app" ]
21
- COPY --from=builder /app .
1
+ FROM golang:1.19.5-buster AS build
2
+
3
+ WORKDIR /app
4
+
5
+ COPY go.mod ./
6
+ COPY go.sum ./
7
+
8
+ RUN go mod download && go mod verify
9
+
10
+ COPY main.go ./
11
+
12
+ RUN go build -o /my-app
13
+
14
+ FROM gcr.io/distroless/base-debian11
15
+
16
+ COPY --from=build /my-app /my-app
17
+
18
+ ENTRYPOINT ["/my-app" ]
Original file line number Diff line number Diff line change 1
1
module more-metrics
2
2
3
3
go 1.19
4
+
5
+ require (
6
+ github.com/beorn7/perks v1.0.1 // indirect
7
+ github.com/cespare/xxhash/v2 v2.1.2 // indirect
8
+ github.com/golang/protobuf v1.5.2 // indirect
9
+ github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
10
+ github.com/prometheus/client_golang v1.14.0 // indirect
11
+ github.com/prometheus/client_model v0.3.0 // indirect
12
+ github.com/prometheus/common v0.37.0 // indirect
13
+ github.com/prometheus/procfs v0.8.0 // indirect
14
+ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
15
+ google.golang.org/protobuf v1.28.1 // indirect
16
+ )
You can’t perform that action at this time.
0 commit comments