change Dockerfile to build first and run a .jar

This commit is contained in:
Lucas Vieira 2023-04-04 16:15:38 -03:00
parent 33354d2997
commit 78b476fc29

View file

@ -2,6 +2,7 @@ FROM openjdk:18
ARG DATABASE
WORKDIR app
COPY . .
RUN /app/mvnw package -DskipTests
EXPOSE 8080
ENV DATABASE ${DATABASE}
CMD sh -c '/app/mvnw spring-boot:run -Dspring-boot.run.profiles=$DATABASE'
CMD sh -c 'java -jar /app/target/*.jar -Dspring-boot.run.profiles=$DATABASE'