Bootstrap: library
From: ubuntu:20.04
Stage: build

%setup

%environment
    export PATH="/root/.local/bin:$PATH"
    export POETRY_VIRTUALENVS_PATH=/bs/virtualenvs
    export POETRY_HOME=/bs/poetry
    export LD_LIBRARY_PATH=/bs/BenchSuite/data/mujoco210/bin/:/usr/lib/nvidia
    export MUJOCO_PY_MUJOCO_PATH=/bs/BenchSuite/data/mujoco210

%post -c /bin/bash
    mkdir /bs
    export POETRY_VIRTUALENVS_PATH=/bs/virtualenvs
    export DEBIAN_FRONTEND=noninteractive
    export POETRY_HOME=/bs/poetry
    export TZ=Etc/UTC
    export LD_LIBRARY_PATH=/bs/BenchSuite/data/mujoco210/bin/:/usr/lib/nvidia
    export MUJOCO_PY_MUJOCO_PATH=/bs/BenchSuite/data/mujoco210
    apt-get update && apt-get -y install software-properties-common swig libglew-dev patchelf libosmesa6-dev libgl1-mesa-glx libglfw3
    add-apt-repository ppa:deadsnakes/ppa
    apt-get update
    apt-get -y install python3-pip python3-wheel git python3.11 python3.11-dev python3.11-venv curl python3.8 python3.8-dev python3.8-venv libc6
    curl -sSL https://install.python-poetry.org | python3.11 -
    export PATH="/bs/poetry/bin:$PATH"
    cd /bs

    ###
    #
    # We had to remove this line because it would violate anonymization
    # You need to copy the bounce directory here to /bs/bounce (i.e., main.py is in /bs/bounce/main.py)
    # We've done this by pulling the GitHub repo using a GitHub token
    #
    ###

    cd bounce
    poetry env use python3.11
    poetry install

%runscript
    echo "Container was created"
    echo "Arguments received: $*"
    bash -c "PATH='/bs/poetry/bin:$PATH' cd /bs/bounce && PATH='/bs/poetry/bin:$PATH' poetry run python3 main.py $*"

%startscript

%test

%labels
    Author Anonymized
    Version v0.0.1

%help
    This is a container for Bounce
