|
1 | 1 | ARG PARENT_IMAGE
|
2 | 2 | FROM $PARENT_IMAGE
|
3 | 3 | ARG PYTORCH_DEPS=cpuonly
|
4 |
| -ARG PYTHON_VERSION=3.7 |
| 4 | +ARG PYTHON_VERSION=3.8 |
| 5 | +ARG MAMBA_DOCKERFILE_ACTIVATE=1 # (otherwise python will not be found) |
5 | 6 |
|
6 |
| -RUN apt-get update && apt-get install -y --no-install-recommends \ |
7 |
| - build-essential \ |
8 |
| - cmake \ |
9 |
| - git \ |
10 |
| - curl \ |
11 |
| - ca-certificates \ |
12 |
| - libjpeg-dev \ |
13 |
| - libpng-dev \ |
14 |
| - libglib2.0-0 && \ |
15 |
| - rm -rf /var/lib/apt/lists/* |
| 7 | +# Install micromamba env and dependencies |
| 8 | +RUN micromamba install -n base -y python=$PYTHON_VERSION \ |
| 9 | + pytorch $PYTORCH_DEPS -c conda-forge -c pytorch -c nvidia && \ |
| 10 | + micromamba clean --all --yes |
16 | 11 |
|
17 |
| -# Install Anaconda and dependencies |
18 |
| -RUN curl -o ~/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \ |
19 |
| - chmod +x ~/miniconda.sh && \ |
20 |
| - ~/miniconda.sh -b -p /opt/conda && \ |
21 |
| - rm ~/miniconda.sh && \ |
22 |
| - /opt/conda/bin/conda install -y python=$PYTHON_VERSION numpy pyyaml scipy ipython mkl mkl-include && \ |
23 |
| - /opt/conda/bin/conda install -y pytorch $PYTORCH_DEPS -c pytorch && \ |
24 |
| - /opt/conda/bin/conda clean -ya |
25 |
| -ENV PATH /opt/conda/bin:$PATH |
26 |
| - |
27 |
| -ENV CODE_DIR /root/code |
| 12 | +ENV CODE_DIR /home/$MAMBA_USER |
28 | 13 |
|
29 | 14 | # Copy setup file only to install dependencies
|
30 |
| -COPY ./setup.py ${CODE_DIR}/stable-baselines3/setup.py |
31 |
| -COPY ./stable_baselines3/version.txt ${CODE_DIR}/stable-baselines3/stable_baselines3/version.txt |
| 15 | +COPY --chown=$MAMBA_USER:$MAMBA_USER ./setup.py ${CODE_DIR}/stable-baselines3/setup.py |
| 16 | +COPY --chown=$MAMBA_USER:$MAMBA_USER ./stable_baselines3/version.txt ${CODE_DIR}/stable-baselines3/stable_baselines3/version.txt |
32 | 17 |
|
33 |
| -RUN \ |
34 |
| - cd ${CODE_DIR}/stable-baselines3 3&& \ |
| 18 | +RUN cd ${CODE_DIR}/stable-baselines3 && \ |
35 | 19 | pip install -e .[extra,tests,docs] && \
|
36 | 20 | # Use headless version for docker
|
37 | 21 | pip uninstall -y opencv-python && \
|
38 | 22 | pip install opencv-python-headless && \
|
39 |
| - rm -rf $HOME/.cache/pip |
| 23 | + pip cache purge |
40 | 24 |
|
41 | 25 | CMD /bin/bash
|
0 commit comments