Skip to content

Commit

Permalink
initial devcontainer setup
Browse files Browse the repository at this point in the history
  • Loading branch information
janrope committed Jul 26, 2023
1 parent 4a572e5 commit f735f7b
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Container base image
# PyTorch image with Python 3.9
ARG BASE_IMAGE="pytorch/pytorch:1.11.0-cuda11.3-cudnn8-runtime"
FROM ${BASE_IMAGE}

# Set display variable to enable rendering through system X server.
# Display and rendering only works with running X server.
ENV DISPLAY=host.docker.internal:0.0

# Update and upgrade standard stuff
RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get install software-properties-common -y && \
add-apt-repository -y multiverse && apt-get update -y && apt-get upgrade -y && \
apt-get install -y apt-utils nano vim man build-essential wget sudo && \
rm -rf /var/lib/apt/lists/*
RUN apt-get update -y && apt-get install -y curl libssl-dev openssl libopenblas-dev \
libhdf5-dev hdf5-helpers hdf5-tools libhdf5-serial-dev libprotobuf-dev protobuf-compiler git

# Enable opengl to show OpenGL based rendering of environments
RUN apt-get update -y && apt-get install -y python-opengl

# Install GPUtil for GPU system monitoring via ray
RUN pip install GPUtil
24 changes: 24 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "dev-container-MARLlib",

// Use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"build": {
// Path is relative to the devcontainer.json file.
"dockerfile": "Dockerfile"
},

// An array of Docker CLI arguments that should be used when running the container
"runArgs": [
// Use available GPUs
"--gpus","all",
"--shm-size","16gb" //Make sure to set this to more than 30% of available RAM.
],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh",

// Connect as root. More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "root"
}
6 changes: 6 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

# Install MARLlib as editable python package
cd /workspaces/MARLlib && pip install -e .
pip install protobuf==3.20
pip install pytest pytest-cov

0 comments on commit f735f7b

Please sign in to comment.