An example service running on Google Cloud Run
Start Docker daemon:
colima start
Build and run the database:
docker rm main
docker run --name main \
-e POSTGRES_USER=main \
-e POSTGRES_PASSWORD=mysecretpassword \
-e POSTGRES_DB=main \
-p 5432:5432 \
-d \
--net=host \
postgres:14
Build and run the application:
./gradlew clean build
docker build -t template-service:0.0.0-development .
docker image tag template-service:0.0.0-development template-service:latest
docker run -p 8080:8080 --net=host template-service:0.0.0-development
./gradlew clean build
docker build -t {Docker repository}/template-service:0.0.0-development .
docker image tag {Docker repository}/template-service:0.0.0-development {Docker repository}/template-service:latest
docker image push --all-tags {Docker repository}/template-service
Replace {Docker repository}
Artifact Registry repository, please see
the documentation for more information
gcloud run deploy template-service \
--image {Docker repository}/template-service:latest \
--allow-unauthenticated \
--region={Region} \
--add-cloudsql-instances={Cloud SQL instance connection name}