FROM node:20-alpine

# Install protobuf compiler
RUN apk add --no-cache protobuf protobuf-dev build-base python3

WORKDIR /app

# Copy package files
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy source code
COPY src ./src/
COPY protobuf ./protobuf/

# Compile protobufs (if using proto:compile script)
# RUN npm run proto:compile

# Create config directory
RUN mkdir -p /config

# Set environment variables
ENV CONFIG_PATH=/config/config.yaml
ENV SECRETS_PATH=/config/secrets.yaml
ENV NODE_ENV=production

# Run the ingestor
CMD ["node", "src/index.js"]
