You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Use a base image that includes OpenJDK 22FROM eclipse-temurin:22-jdk-alpine
# Install MavenRUN apk add --no-cache maven
# Set the working directoryWORKDIR /app
# Copy the Maven project filesCOPY . .
# Run Maven to build the projectRUN mvn clean install
EXPOSE 8080
RUN cp target/*.jar app.jar
ENTRYPOINT [ "java", "-jar", "app.jar" ]
JDK 21
# Etapa 1: Build com MavenFROM maven:3.9.9-eclipse-temurin-21-alpine AS build
WORKDIR /app
COPY . .
RUN mvn clean package -DskipTests
# Etapa 2: Execução com OpenJDK 21FROM azul/zulu-openjdk-alpine:21
WORKDIR /app
COPY --from=build /app/target/*.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "app.jar"]
JDK 17
FROM ubuntu:latest AS build
RUN apt-get update
RUN apt-get install openjdk-17-jdk -y
COPY . .
RUN apt-get install maven -y
RUN mvn clean install
FROM openjdk:17-jdk-slim
EXPOSE 8080
COPY --from=build /target/*.jar app.jar
ENTRYPOINT [ "java", "-jar", "app.jar" ]