-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
memorystore: add Dockerfile for Cloud Run deployment #1538
Changes from 4 commits
3106afa
2d10fb6
9a7229f
b887816
185113e
04f531b
7a40ac4
de643bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
cloud_run_deployment/ | ||
gae_flex_deployment/ | ||
gae_standard_deployment/ | ||
gce_deployment/ | ||
gke_deployment/ | ||
README.md |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Use the official Golang image to create a build artifact. | ||
# This is based on Debian and sets the GOPATH to /go. | ||
# https://hub.docker.com/_/golang | ||
FROM golang:1.13 as builder | ||
|
||
# Create and change to the app directory. | ||
WORKDIR /app | ||
|
||
# Retrieve application dependencies. | ||
# This allows the container build to reuse cached dependencies. | ||
COPY go.* ./ | ||
RUN go mod download | ||
|
||
# Copy local code to the container image. | ||
COPY . ./ | ||
|
||
# Build the binary. | ||
RUN CGO_ENABLED=0 GOOS=linux go build -v -o server | ||
|
||
# Use the official Alpine image for a lean production container. | ||
# https://hub.docker.com/_/alpine | ||
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds | ||
FROM alpine:3 | ||
RUN apk add --no-cache ca-certificates | ||
|
||
# Copy the binary to the production image from the builder stage. | ||
COPY --from=builder /app/server /server | ||
|
||
# Run the web service on container startup. | ||
CMD ["/server"] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module github.com/GoogleCloudPlatform/golang-samples/memorystore/redis | ||
|
||
go 1.13 | ||
|
||
require github.com/gomodule/redigo v2.0.0+incompatible | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like the redigo community has been spinning on what to do about this incompatible flag, possibly 2.0 is meant to be ignored. Resolution in gomodule/redigo#366 or gomodule/redigo#440 are not clearly documented. I wonder if it's since been fixed, and re-generating the go.mod and go.sum would help? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like it's fixed - I regenerated |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0= | ||
github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use 1.13 or 1.14? If this is only for Cloud Run, it seems like we should use 1.14?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current "canonical" Dockerfile base image is
golang:1.13-buster
, though #1541 proposed to update that to 1.14. I'm fine rolling that forward. More significantly, this Dockerfile is a copy of an earlier version of the template used in Cloud Run, it would be best to update this from the Cloud Run Pub/Sub sample DockerfileThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the Dockerfile based on the Cloud Run Pub/Sub sample, thanks