Skip to content

Instantly share code, notes, and snippets.

@maxisandoval37
Last active January 9, 2024 01:31
Show Gist options
  • Save maxisandoval37/0bf9c293a2a2c1b1a8df8e618049be2c to your computer and use it in GitHub Desktop.
Save maxisandoval37/0bf9c293a2a2c1b1a8df8e618049be2c to your computer and use it in GitHub Desktop.
Dockerfile for Maven java
# --Dockerfile for Maven java---
FROM ubuntu:latest AS build
RUN apt-get update
RUN apt-get install openjdk-17-jdk -y
COPY . .
RUN chmod +x mvnw
RUN chmod +x ./mvnw
RUN ./mvnw dependency:go-offline -B
RUN ./mvnw clean package -DskipTests
FROM openjdk:17-jdk-slim
EXPOSE 8081
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