FROM node:21

# Install dependencies
RUN apt-get update && \
    apt-get install -y bgpq3 && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
COPY package*.json ./
RUN npm install

# Bundle app source
COPY . .

RUN node buildIpRange.js

# Expose port and start the application
EXPOSE 3000
CMD [ "node", "server.js" ]
