Skip to content

Instantly share code, notes, and snippets.

@sheikhoo
Created January 21, 2023 07:34
Show Gist options
  • Save sheikhoo/e09976a4507aa3eb5aa646d6f5454682 to your computer and use it in GitHub Desktop.
Save sheikhoo/e09976a4507aa3eb5aa646d6f5454682 to your computer and use it in GitHub Desktop.
Dockerfile example Spring Boot 3 & JDK 17
FROM maven:3.8.3-openjdk-17 AS builder
ADD . /app
WORKDIR /app
RUN mvn -f /app/pom.xml clean package
FROM openjdk:17.0.1-jdk-slim
COPY --from=builder /app/target/<TARGET-JAR-FILE-NAME>.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","app.jar"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment