Deploy Spring Boot with GCP Cloud Run and Cloud Build
Published in
2 min readAug 6, 2023
Deploy Spring Boot application with Cloud Run and Cloud Build GCP Services
Topics include:
- Setup a multistage Dockerfile
- Cloud Run configuration
- Cloud Build configuration
- Github connection and build logs
- Attach a custom domain
Prerequisites:
- Spring Boot Project
- GCP with Cloud Run
- GIT Repository with Spring Boot
Multistage Dockerfile for a Spring Boot application
The first thing you need for your Spring Boot project is to prepare a Dockerfile.
Here is an example Dockerfile with a multistage build:
FROM eclipse-temurin:17-jdk-jammy as builder
WORKDIR /opt/app
COPY .mvn/ .mvn
COPY mvnw pom.xml ./
RUN ./mvnw dependency:go-offline
COPY ./src ./src
RUN ./mvnw clean…