FROM node:22-alpine AS build
WORKDIR /site
COPY . .
RUN npm i
RUN npm run astro telemetry disable
RUN npm run build

FROM forgejo.neshweb.net/ci-docker-images/website-serve:2 AS runtime

COPY --from=build /site/dist /public
COPY --from=build /site/serve.json /public/serve.json

ENV PORT=8081
EXPOSE 8081

CMD serve public/ -p ${PORT}