# Expected build-time mounts:
# - /grr/src
# - /grr/persist

FROM ubuntu:22.04

ARG NODEJS_VERSION

RUN apt-get update && apt-get install -y \
  python3-pip \
  python-is-python3 \
  python3.10-venv \
  python3-yaml \
  pkg-config \
  libmysqlclient-dev \
  openjdk-19-jre

RUN cd /grr/persist \
  && python -m venv --system-site-packages venv \
  && . venv/bin/activate \
  && pip install mysqlclient nodeenv wheel \
  && nodeenv -p --prebuilt --node=$NODEJS_VERSION

RUN cd /grr/src \
  && . /grr/persist/venv/bin/activate \
  && pip install -e grr/proto \
  && pip install -e grr/core \
  && pip install -e grr/client \
  && pip install -e grr/client_builder \
  && pip install -e api_client/python \
  && pip install -e grr/server \
  && pip install -e grr/test
