FROM node:23-bookworm

RUN apt update && apt upgrade -y
RUN apt install -y bubblewrap

WORKDIR /app

# Install elan
RUN curl -sSfL https://github.com/leanprover/elan/releases/download/v3.0.0/elan-x86_64-unknown-linux-gnu.tar.gz | tar xz && \
    ./elan-init -y

ENV PATH="/root/.elan/bin:${PATH}"

# Copy package files
COPY package.json package-lock.json ./

# Install dependencies
RUN npm install

# Copy project files
COPY . .

# Build the project
RUN npm run build

EXPOSE 8080

# Set the entrypoint
CMD ["npm", "run", "production"]
