Created
January 2, 2022 14:45
-
-
Save tseho/cd0cc8b042b478632149be77b1ac4245 to your computer and use it in GitHub Desktop.
Deploy serverless
This file contains hidden or 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
# Build and push the docker image, then deploy a new release of the Cloud Run service | |
.PHONY: api.deploy | |
api.deploy: | |
docker build . -t $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_VERSION) | |
docker push $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_VERSION) | |
gcloud --project $(GCLOUD_PROJECT) run deploy $(GCLOUD_SERVICE) --image $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_VERSION) --region $(GCLOUD_REGION) |
This file contains hidden or 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
# Build a docker image with `yarn install` & `yarn build` as steps, | |
# copy the result into a local directory then push the files to the GCP bucket | |
.PHONY: app.deploy | |
app.deploy: | |
docker build . -t $(DOCKER_IMAGE_NAME):$(TAG) | |
docker cp $$(docker create --rm $(DOCKER_IMAGE_NAME):$(TAG)):/srv/app/build ./build | |
gsutil -m rm -r gs://$(GCLOUD_BUCKET_APP)/$(TAG) || true | |
gsutil -m cp -r ./build gs://$(GCLOUD_BUCKET_APP)/$(TAG) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment