- Start the local server:
./gradlew bootRun
- (Optional) To enable auto-reload, in another terminal / shell:
./gradlew -t classes
- Open: localhost:8080
-
Enable the Container, Container Registry, Cloud Build, and Cloud Run APIs:
gcloud services enable container.googleapis.com containerregistry.googleapis.com cloudbuild.googleapis.com run.googleapis.com
-
Build the container image on Cloud Build using Buildpacks, storing the image on Google Container Registry:
export PROJECT_ID=YOUR_GCP_PROJECT_ID gcloud builds submit --pack=image=gcr.io/$PROJECT_ID/sample-java-springboot-gradle
-
Deploy on Google Cloud Run:
gcloud run deploy \ --image=gcr.io/$PROJECT_ID/sample-java-springboot-gradle \ --platform=managed \ --allow-unauthenticated \ --project=$PROJECT_ID \ --region=us-central1 \ sample-java-springboot-gradle
-
Build the image
./gradlew bootBuildImage --builder=gcr.io/buildpacks/builder:v1 --imageName=sample-java-springboot-gradle
-
Run image:
docker run -p8080:8080 sample-java-springboot-gradle
-
Open: localhost:8080