DEV Community

Terence Pan
Terence Pan

Posted on

Deploy Spring Boot App to Render

Render is an alternative to Heroku with a free tier. We can deploy a Spring Boot app here with a Dockerfile.

Dockerfile contents

(place at root of repo, change according to artifact name, version and jdk versions)

# Build stage
FROM maven:3.8.3-openjdk-17 AS build
COPY . .
RUN mvn clean install

# Package stage
FROM eclipse-temurin:17-jdk
COPY --from=build /target/demo-0.0.1-SNAPSHOT.jar demo.jar
# ENV PORT=8080
ENTRYPOINT ["java","-jar","demo.jar"]
Enter fullscreen mode Exit fullscreen mode

Render instructions

New -> New Web Service -> Connect Github or Gitlab -> Pick Docker runtime -> Create Web Service

Image description

Top comments (0)