FROM node:18 AS build

WORKDIR /srv

COPY ./package.json ./package-lock.json /srv/
RUN npm install
COPY tsconfig.json tsconfig.app.json tsconfig.node.json vite.config.ts .env.development .env.production /srv/

COPY src /srv/src
COPY public /srv/public
COPY map /srv/map
COPY summon /srv/summon
COPY chromecast /srv/chromecast
COPY ./index.html /srv/

RUN npm run build

FROM nginx:latest

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

EXPOSE 80