# vi: ft=dockerfile
FROM docker.io/node:22-alpine3.19 as build

WORKDIR /app

ADD site .

RUN npm install

RUN npm run build

FROM docker.io/nginx:1.27.1-alpine

RUN apk add openjdk17

RUN mkdir /app

WORKDIR /app

ADD api/gradlew .
ADD api/gradle gradle

RUN ./gradlew

ADD nginx.proxy.conf /nginx.conf

RUN mkdir -p /www/page

ADD api /app

RUN ./gradlew bootJar

ADD entrypoint.sh /usr/bin

COPY --from=build /app/build/ /www/page/

ENTRYPOINT ["entrypoint.sh"]
