FROM gradle:8.14.2-jdk21 AS build

WORKDIR /app

COPY . .

RUN gradle --no-daemon clean build -x test

FROM eclipse-temurin:21-jre

WORKDIR /app

COPY --from=build /app/build/libs/*.jar app.jar

RUN mkdir -p /data/uploads && chmod 755 /data/uploads

ENV BUILD_TIME_BACK="unknown"\
    BUILD_TIME_FRONT="unknown"

EXPOSE 8080

CMD ["java", "-jar", "app.jar"]