content: FROM node:20.17.0-bookworm-slim
  
  ENV DEBIAN_FRONTEND=noninteractive
  ENV NX_VERSION=19.6.2
  ENV NX_SOCKET_DIR="/tmp/nx"
  ENV BUILD_PACKAGES="make cmake g++ git python3 curl ca-certificates gnupg apt-transport-https lsb-release"
  ENV SCRAM_BUILD_PACKAGES="libxml2-dev libomp-dev libgoogle-perftools-dev libboost-program-options-dev libboost-math-dev libboost-random-dev libboost-filesystem-dev libboost-test-dev libboost-date-time-dev libjemalloc-dev"
  ENV SCRAM_RUNTIME_PACKAGES="libxml2 libboost-filesystem1.74.0 libboost-program-options1.74.0 libtcmalloc-minimal4 libjemalloc2"
  ENV PATH="/root/.local/bin:${PATH}"
  
  WORKDIR /workspaces/openpra-monorepo
  SHELL ["/bin/bash", "-c"]
  
  # Install system dependencies
  RUN apt-get update && \
      apt-get install -y --no-install-recommends \
          $BUILD_PACKAGES \
          $SCRAM_BUILD_PACKAGES \
          $SCRAM_RUNTIME_PACKAGES
  
  # Install MongoDB
  RUN curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
          gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor && \
      echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] http://repo.mongodb.org/apt/debian bookworm/mongodb-org/8.0 main" > /etc/apt/sources.list.d/mongodb-org-8.0.list && \
      apt-get update && \
      apt-get install -y --no-install-recommends mongodb-org
  
  # Install RabbitMQ and Erlang (official instructions)
  RUN curl -fsSL "https://keys.openpgp.org/vks/v1/by-fingerprint/0A9AF2115F4687BD29803A206B73A36E6026DFCA" | gpg --dearmor -o /usr/share/keyrings/com.rabbitmq.team.gpg && \
      curl -fsSL https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-erlang.E495BB49CC4BBE5B.key | gpg --dearmor -o /usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg && \
      curl -fsSL https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-server.9F4587F226208342.key | gpg --dearmor -o /usr/share/keyrings/rabbitmq.9F4587F226208342.gpg && \
      tee /etc/apt/sources.list.d/rabbitmq.list > /dev/null <<EOF
  deb [arch=amd64 signed-by=/usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg] https://ppa1.rabbitmq.com/rabbitmq/rabbitmq-erlang/deb/debian bookworm main
  deb-src [signed-by=/usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg] https://ppa1.rabbitmq.com/rabbitmq/rabbitmq-erlang/deb/debian bookworm main
  deb [arch=amd64 signed-by=/usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg] https://ppa2.rabbitmq.com/rabbitmq/rabbitmq-erlang/deb/debian bookworm main
  deb-src [signed-by=/usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg] https://ppa2.rabbitmq.com/rabbitmq/rabbitmq-erlang/deb/debian bookworm main
  deb [arch=amd64 signed-by=/usr/share/keyrings/rabbitmq.9F4587F226208342.gpg] https://ppa1.rabbitmq.com/rabbitmq/rabbitmq-server/deb/debian bookworm main
  deb-src [signed-by=/usr/share/keyrings/rabbitmq.9F4587F226208342.gpg] https://ppa1.rabbitmq.com/rabbitmq/rabbitmq-server/deb/debian bookworm main
  deb [arch=amd64 signed-by=/usr/share/keyrings/rabbitmq.9F4587F226208342.gpg] https://ppa2.rabbitmq.com/rabbitmq/rabbitmq-server/deb/debian bookworm main
  deb-src [signed-by=/usr/share/keyrings/rabbitmq.9F4587F226208342.gpg] https://ppa2.rabbitmq.com/rabbitmq/rabbitmq-server/deb/debian bookworm main
  EOF
  
  RUN apt-get update && \
      apt-get install -y --no-install-recommends erlang-base \
          erlang-asn1 erlang-crypto erlang-eldap erlang-ftp erlang-inets \
          erlang-mnesia erlang-os-mon erlang-parsetools erlang-public-key \
          erlang-runtime-tools erlang-snmp erlang-ssl \
          erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl && \
      apt-get install -y --no-install-recommends rabbitmq-server
  
  # Clean up
  RUN apt-get clean && rm -rf /var/lib/apt/lists/*
  
  # Create MongoDB data directory
  RUN mkdir -p /data/db && chown -R mongodb:mongodb /data/db
  
  # Install Node.js global tools
  RUN npm install --global pnpm nx@$NX_VERSION && SHELL=bash pnpm setup
  
  # Copy source code
  COPY .. .
  
  # Initialize git submodules
  RUN source /root/.bashrc
  
  # Copy entrypoint script
  COPY standalone_entrypoint.sh /
  RUN chmod +x /standalone_entrypoint.sh
  