FROM node:18

# Set working directory
WORKDIR /app

# Setup build args clearly
ARG VITE_OPENAPI_BASE_DEV
ARG VITE_SSL_KEY_PATH
ARG VITE_SSL_CERT_PATH
ARG NODE_ENV=development

ENV VITE_OPENAPI_BASE_=${VITE_OPENAPI_BASE}
ENV VITE_SSL_KEY_PATH=${VITE_SSL_KEY_PATH}
ENV VITE_SSL_CERT_PATH=${VITE_SSL_CERT_PATH}
ENV NODE_ENV=${NODE_ENV}


# Copy dependency files and install dependencies
COPY package*.json ./
RUN npm install --prefer-offline --no-audit --progress=false


# Copy rest of the code and build the application
COPY . .

# Use a simple HTTP server to serve the built static files
EXPOSE 5173
#CMD ["npx", "vite", "preview", "--port", "5173"]
CMD ["npm", "run", "dev"]