FROM node:lts-alpine AS install-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .

FROM git.legonzaur.fr/heronfief/cards-gen:main AS svg-stage
RUN python3 -u ./src/generate_cards_mvp.py

FROM install-stage AS build-stage
COPY --from=svg-stage /app/output/heron ./assets/images/cards/heron-svg

ARG NUXT_PUBLIC_ENDPOINT
ARG NUXT_PUBLIC_DISCORD_LOGIN_ENDPOINT
ARG NUXT_PUBLIC_WELCOME_MESSAGE

RUN npx nuxi generate

# étape de production
FROM nginx:stable-alpine AS production-stage
COPY --from=build-stage /app/.output/public /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/conf.d/default.conf