Last active
September 29, 2023 08:21
-
-
Save karl-gustav/ad79e111f8614f058adc63bb92d297ad to your computer and use it in GitHub Desktop.
Good example of Makefile for using google run containers with gopass
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
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