# Use an official Node.js runtime as a parent image
FROM node:18

# Set the working directory
WORKDIR /app

# Install pnpm
RUN npm install -g pnpm

# Copy package.json and pnpm-lock.yaml
COPY package.json pnpm-lock.yaml ./

# Accept build arguments
ARG RIOT_APIKEY

# Set environment variables
ENV RIOT_APIKEY=$RIOT_APIKEY

# Install dependencies using pnpm
RUN pnpm install

# Copy the rest of the application code
COPY . .

# Build the application (if needed)
RUN pnpm build

# Expose the port the app runs on
EXPOSE 4173

# Command to run the application
CMD ["pnpm", "dev"]