Skip to content

Instantly share code, notes, and snippets.

@maxisandoval37
Last active August 5, 2025 03:10
Show Gist options
  • Select an option

  • Save maxisandoval37/0bf9c293a2a2c1b1a8df8e618049be2c to your computer and use it in GitHub Desktop.

Select an option

Save maxisandoval37/0bf9c293a2a2c1b1a8df8e618049be2c to your computer and use it in GitHub Desktop.
Dockerfile for Maven java
# --Dockerfile for Maven Java JAR (jdk 17)---
FROM eclipse-temurin:17-jdk-alpine AS build
COPY . .
RUN chmod +x ./mvnw \
&& ./mvnw dependency:go-offline -B \
&& ./mvnw clean package -DskipTests
FROM eclipse-temurin:17-jre-alpine
EXPOSE 8080
COPY --from=build target/*.jar demo.jar
ENTRYPOINT ["java", "-jar", "demo.jar"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment