diff --git a/Dockerfile b/Dockerfile index 3554e4cc3..9f8631be8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,27 +11,31 @@ RUN apt-get update && \ npm install -g yarn ### install frontend dependencies -COPY ./src/main/resources/frontend/package.json ./src/main/resources/frontend/yarn.lock /app/src/main/resources/frontend/ +COPY ./src/main/resources/frontend/package.json ./src/main/resources/frontend/yarn.lock ./src/main/resources/frontend/ RUN cd src/main/resources/frontend && \ yarn ### install backend dependencies -COPY ./pom.xml /app +COPY ./pom.xml . RUN mvn dependency:go-offline ### build frontend -COPY ./src/main/resources/frontend /app/src/main/resources/frontend +COPY ./src/main/resources/frontend ./src/main/resources/frontend RUN cd src/main/resources/frontend && \ yarn build ### build backend -COPY . /app +COPY ./src ./src RUN mvn clean package -DskipTests +FROM maven:3.9.6-amazoncorretto-21-debian-bookworm AS runner + +COPY --from=builder /app/target/automatico-1.0-SNAPSHOT.jar /app/target/ + EXPOSE 8080 CMD ["java", "-Dlog4j2.configurationFile=log4j.properties", "-Dlog4j2.debug=false", "-jar", "/app/target/automatico-1.0-SNAPSHOT.jar"]