FROM docker.io/library/eclipse-temurin:21-jdk-jammy AS build
RUN apt-get update && apt-get install -y --no-install-recommends python3 && rm -rf /var/lib/apt/lists/*
WORKDIR /src
COPY . .
RUN chmod +x gradlew && ./gradlew :web:webBuild --no-daemon --console=plain && python3 scripts/package_web.py && python3 -m unittest discover -s tests -v
FROM docker.io/nginxinc/nginx-unprivileged:1.28-alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /src/web/build/dist/webapp /usr/share/nginx/html
EXPOSE 8080
