Skip to content

Instantly share code, notes, and snippets.

Avatar

Grant Timmerman grant

View GitHub Profile
View gcloud_number2id.sh
PROJECT_ID=$(gcloud projects list \
--filter="$PROJECT_NUMBER" \
--format="value(project_id)")
echo $PROJECT_ID
View gcloud_id2number.sh
PROJECT_NUMBER=$(gcloud projects list \
--filter="project_id:$PROJECT_ID" \
--format='value(project_number)')
echo $PROJECT_NUMBER
View gcloud_run_auth.sh
RUN_SERVICE=helloworld
RUN_SERVICE_URL=$(gcloud run services describe $RUN_SERVICE --format 'value(status.address.url)')
curl -H "Authorization: Bearer $(gcloud auth print-identity-token)" $RUN_SERVICE_URL
View gcloud_billing.sh
gcloud beta billing projects describe \
$(gcloud config get-value project) \
--format="value(billingEnabled)"
View gcloud_project.sh
# Set project
gcloud config set project "my-project"
# Get project
PROJECT=$(gcloud config get-value core/project 2> /dev/null)
@grant
grant / call.sh
Created Jun 9, 2020
Call a .NET function
View call.sh
RUN_SERVICE=$(gcloud run services describe hellodotnet --format 'value(status.address.url)')
curl -H "Authorization: Bearer $(gcloud auth print-identity-token)" $RUN_SERVICE
@grant
grant / Dockerfile
Created Jun 8, 2020
.NET FF Dockerfile
View Dockerfile
# Use Microsoft's official build .NET image.
# https://hub.docker.com/_/microsoft-dotnet-core-sdk/
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine AS build
WORKDIR /app
# Install production dependencies.
# Copy csproj and restore as distinct layers.
COPY *.csproj ./
RUN dotnet restore
@grant
grant / deploy.sh
Last active Jun 8, 2020
Deploy a .NET container to Cloud Run
View deploy.sh
GCP_PROJECT=$(gcloud config list --format 'value(core.project)')
gcloud builds submit --tag gcr.io/$GCP_PROJECT/hellodotnet
gcloud run deploy hellodotnet \
--image gcr.io/$GCP_PROJECT/hellodotnet \
--platform managed \
--no-allow-unauthenticated
@grant
grant / install.sh
Created Jun 8, 2020
Install the .NET FF
View install.sh
dotnet new -i Google.Cloud.Functions.Templates::1.0.0-alpha07
You can’t perform that action at this time.