# syntax=docker/dockerfile:1.7

FROM node:24.16.0-alpine AS build

WORKDIR /app/Store

RUN corepack enable && corepack prepare pnpm@10.24.0 --activate

COPY Store/package.json Store/pnpm-lock.yaml Store/pnpm-workspace.yaml ./
RUN pnpm install --frozen-lockfile

ARG ALLOWED_HOSTS=""
ARG STRIPE_PUBLISHABLE_KEY=""
ARG STRIPE_PRICE_ID=""
ARG API_BASE_URL=""

ENV ALLOWED_HOSTS=${ALLOWED_HOSTS}
ENV STRIPE_PUBLISHABLE_KEY=${STRIPE_PUBLISHABLE_KEY}
ENV STRIPE_PRICE_ID=${STRIPE_PRICE_ID}
ENV API_BASE_URL=${API_BASE_URL}

COPY Store/ ./

RUN pnpm build

FROM nginx:1.27-alpine AS runtime

COPY Proxy/default.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/Store/dist /usr/share/nginx/html

EXPOSE 80
EXPOSE 443
