Skip to content

Instantly share code, notes, and snippets.

@sheikhoo
Created January 21, 2023 07:33
Show Gist options
  • Save sheikhoo/5cbb05272a17368324d8e035f087cc1f to your computer and use it in GitHub Desktop.
Save sheikhoo/5cbb05272a17368324d8e035f087cc1f to your computer and use it in GitHub Desktop.
Dockerfile example Spring Boot 2 & JDK 8
FROM maven:3.6.3-jdk-8 AS builder
ADD . /app
WORKDIR /app
RUN mvn -f /app/pom.xml clean package -DskipTests
FROM openjdk:8-jre-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