tianshou Docker & Self-Hosted Deployment

GitHub

An elegant PyTorch deep reinforcement learning library.

11,048 stars Python Python 21 files ยท ~495,523 tokens #a2c#atari#bcq#cql#ddpg#double-dqn#dqn#drl
1. Pull Image (DOCKERHUB) docker pull thu-ml/tianshou:latest
2. Docker Run (1-Click Launch) docker run -d --name tianshou --restart always thu-ml/tianshou:latest
3. Podman Run podman run -d --name tianshou --restart always thu-ml/tianshou:latest
4. Skopeo Inspect (Zero-Pull Manifest) skopeo inspect docker://docker.io/thu-ml/tianshou:latest
5. ORAS Pull (OCI Artifact) oras pull thu-ml/tianshou:latest
Dockerfile
# Use the official Python image for the base image.
FROM --platform=linux/amd64 python:3.11-slim

# Set environment variables to make Python print directly to the terminal and avoid .pyc files.
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1

# Install system dependencies required for the project.
RUN apt-get update && apt-get install -y --no-install-recommends \
    curl \
    build-essential \
    git \
    wget \
    unzip \
    libvips-dev \
    gnupg2 \
    && rm -rf /var/lib/apt/lists/*


# Install pipx.
RUN python3 -m pip install --no-cache-dir pipx \
    && pipx ensurepath

# Add poetry to the path
ENV PATH="${PATH}:/root/.local/bin"

# Install the latest version of Poetry using pipx.
RUN pipx install poetry

# Set the working directory. IMPORTANT: can't be changed as needs to be in sync to the dir where the project is cloned
# to in the codespace
WORKDIR /workspaces/tianshou

# Copy the pyproject.toml and poetry.lock files (if available) into the image.
COPY pyproject.toml poetry.lock* README.md /workspaces/tianshou/

RUN poetry config virtualenvs.create false
RUN poetry install --no-root --with dev

# The entrypoint will perform an editable install, it is expected that the code is mounted in the container then
# If you don't want to mount the code, you should override the entrypoint
ENTRYPOINT ["/bin/bash", "-c", "poetry install --with dev && poetry run jupyter trust notebooks/*.ipynb docs/02_notebooks/*.ipynb && $0 $@"]