# Step 1 - Building the app
FROM node:22 AS build
WORKDIR /app
COPY package*.json ./
# Set environment variables
ARG BACKEND_URL
ENV VITE_TARGO_BACKEND_URL=$BACKEND_URL
# Install dependencies
RUN npm install -g @quasar/cli
COPY . .
RUN npm install
RUN npm run build

# Step 2 - Move Applicatin to Nginx
FROM nginx:alpine
COPY --from=build /app/dist/spa /usr/share/nginx/html
RUN mkdir /usr/share/nginx/html/src
COPY --from=build /app/src /usr/share/nginx/html/src
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]