File tree Expand file tree Collapse file tree 7 files changed +35
-219
lines changed
Expand file tree Collapse file tree 7 files changed +35
-219
lines changed Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- FROM golang:1.24-alpine
15+ FROM golang:1.24-bookworm AS builder
1616
17- RUN apk update && apk add git
17+ WORKDIR /app
1818
19- RUN go get github.com/gomodule/redigo/redis
19+ COPY go.mod go.sum ./
20+ RUN go mod download
21+ COPY *.go ./
22+ RUN CGO_ENABLED=0 go build -o app .
2023
21- ADD . /go/src/visit-counter
22- RUN go install visit-counter
24+ FROM scratch
2325
24- ENV REDISHOST redis
25- ENV REDISPORT 6379
26+ WORKDIR /app
2627
27- ENTRYPOINT /go/bin/visit-counter
28+ COPY --from=builder /app/app .
2829
30+ ENV REDISHOST=redis
31+ ENV REDISPORT=6379
32+
33+ ENTRYPOINT ["/app/app" ]
2934EXPOSE 8080
Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- apiVersion : extensions/v1beta1
15+ # [START memorystore_go_visit_counter_yaml]
16+ apiVersion : apps/v1
1617kind : Deployment
1718metadata :
1819 name : visit-counter
1920 labels :
2021 app : visit-counter
2122spec :
2223 replicas : 1
24+ selector :
25+ matchLabels :
26+ app : visit-counter
2327 template :
2428 metadata :
2529 labels :
5054 - port : 80
5155 targetPort : 8080
5256 protocol : TCP
53-
57+ # [END memorystore_go_visit_counter_yaml]
Original file line number Diff line number Diff line change 1+ module visit-counter
2+
3+ go 1.24
4+
5+ require github.com/gomodule/redigo v1.9.3
Original file line number Diff line number Diff line change 1+ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c =
2+ github.com/davecgh/go-spew v1.1.1 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
3+ github.com/gomodule/redigo v1.9.3 h1:dNPSXeXv6HCq2jdyWfjgmhBdqnR6PRO3m/G05nvpPC8 =
4+ github.com/gomodule/redigo v1.9.3 /go.mod h1:KsU3hiK/Ay8U42qpaJk+kuNa3C+spxapWpM+ywhcgtw =
5+ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM =
6+ github.com/pmezard/go-difflib v1.0.0 /go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4 =
7+ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk =
8+ github.com/stretchr/testify v1.8.4 /go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo =
9+ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA =
10+ gopkg.in/yaml.v3 v3.0.1 /go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM =
Original file line number Diff line number Diff line change 1414
1515// [START memorystore_main_go]
1616
17- // Command redis is a basic app that connects to a managed Redis instance.
17+ // Package main is a basic app that connects to a managed Redis instance.
1818package main
1919
2020import (
You can’t perform that action at this time.
0 commit comments