# ==
# Build the Vue app
# ==

# ARG NODE_VERSION=22.14.0-alpine
# ARG NGINX_VERSION=alpine3.22

# FROM node:${NODE_VERSION} as builder

# WORKDIR /app

# COPY package.json package-lock.json* ./

# RUN --mount=type=cache,target=/root/.npm npm ci

# COPY . .

# RUN npm run build

# ==
# Prepare NGINX for static files
# ==

# FROM nginxinc/nginx-unprivileged:${NGINX_VERSION} as runner

# COPY nginx.conf /etc/nginx/nginx.conf


FROM node:lts-alpine

# install simple http server for serving static content
RUN npm install -g http-server@latest

# make the 'app' folder the current working directory
WORKDIR /app

# copy both 'package.json' and 'package-lock.json' (if available)
COPY package*.json ./

# install project dependencies
RUN npm install

# copy project files and folders to the current working directory (i.e. 'app' folder)
COPY . .

# build app for production with minification
RUN npm run build

EXPOSE 8080
EXPOSE 5173
CMD [ "http-server", "dist" ]
