Skip to content

Instantly share code, notes, and snippets.

@karl-gustav
Last active September 29, 2023 08:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karl-gustav/ad79e111f8614f058adc63bb92d297ad to your computer and use it in GitHub Desktop.
Save karl-gustav/ad79e111f8614f058adc63bb92d297ad to your computer and use it in GitHub Desktop.
Good example of Makefile for using google run containers with gopass
export DOCKER_BUILDKIT=1
GPC_PROJECT_ID=hkraft-iot
SERVICE_NAME=defibrilator-registry
CONTAINER_NAME=europe-west1-docker.pkg.dev/$(GPC_PROJECT_ID)/cloud-run/$(SERVICE_NAME)
.PHONY: *
run: build
docker run -it -p 8080:8080\
-e CLIENT_ID=$$(gopass hjertestarterregisteret.no/client-id)\
-e CLIENT_SECRET=$$(gopass hjertestarterregisteret.no/client-secret)\
$(CONTAINER_NAME)
build:
docker build -t $(CONTAINER_NAME) .
push: build
docker push $(CONTAINER_NAME)
deploy: build push
gcloud run deploy $(SERVICE_NAME)\
--project $(GPC_PROJECT_ID)\
--allow-unauthenticated\
-q\
--region europe-west1\
--platform managed\
--set-env-vars CLIENT_ID=$$(gopass hjertestarterregisteret.no/client-id),CLIENT_SECRET=$$(gopass hjertestarterregisteret.no/client-secret)\
--memory 128Mi\
--image $(CONTAINER_NAME)
test:
go test ./...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment