-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from spowelljr/cloudbuild
CI: Add cloudrun deploy script
- Loading branch information
Showing
3 changed files
with
32 additions
and
6 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,14 @@ | ||
FROM golang:1.21 AS builder | ||
WORKDIR /app | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
COPY cmd/gopogh-server/main.go ./ | ||
COPY pkg ./pkg | ||
RUN CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -o /gopogh-server | ||
|
||
FROM alpine:3 | ||
WORKDIR / | ||
RUN apk add --no-cache ca-certificates | ||
COPY --from=builder /gopogh-server /gopogh-server | ||
EXPOSE 8080 | ||
CMD ["/gopogh-server", "-use_cloudsql", "-use_iam_auth"] |
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
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,18 @@ | ||
#!/bin/bash | ||
|
||
set -eux | ||
|
||
export IMAGE=gcr.io/k8s-minikube/gopogh-server | ||
|
||
docker buildx build --platform linux/amd64 -t "${IMAGE}" -f Dockerfile.server . | ||
|
||
docker push "${IMAGE}" || exit 2 | ||
|
||
gcloud run deploy gopogh-server \ | ||
--project k8s-minikube \ | ||
--image "${IMAGE}" \ | ||
--set-env-vars="DB_HOST=${DB_HOST},DB_PATH=${DB_PATH}" \ | ||
--allow-unauthenticated \ | ||
--region us-central1 \ | ||
--memory 4Gi \ | ||
--platform managed |