Deploying a springboot app

Hi guys, I need help on deploying a spring boot application. I get “Scanning source code
No runtime detected or framework from source code. Continuing with a default setup.” everytime I run andasy setup

Hi @samolubode,

Our CLI doesn’t yet generate Dockerfiles for Spring Boot, but I put together a minimal example that worked in my tests.

You can use it as a starting point to verify it works in your setup. Create the Dockerfile first, then run andasy setup. When prompted, skip overwriting the Dockerfile; the command will generate an andasy.hcl file.

Sample Dockerfile:

# Stage 1: Build the application
FROM eclipse-temurin:17-jdk AS builder

WORKDIR /app

# Copy all necessary files for the build
COPY gradlew .
COPY gradle gradle
COPY build.gradle .
COPY settings.gradle .
COPY src src

RUN chmod +x ./gradlew

# Build the application
RUN ./gradlew clean bootJar --no-daemon

# Stage 2: Create the final image with a smaller base image
FROM eclipse-temurin:17-jre-alpine

WORKDIR /app

COPY --from=builder /app/build/libs/*.jar app.jar

ENTRYPOINT ["java", "-jar", "app.jar"]

Let me know if this works for you.