Unverified Commit 578a8c8a authored by Nikita Titov's avatar Nikita Titov Committed by GitHub
Browse files

updated docker folder (#2316)

* updated docker folder

* added depth=1 option to all git commands
parent b0b45911
# Using LightGBM via Docker
# Using LightGBM via Docker
This directory contains `Dockerfile` to make it easy to build and run LightGBM via [Docker](http://www.docker.com/).
This directory contains `Dockerfile`s to make it easy to build and run LightGBM via [Docker](https://www.docker.com/).
## Installing Docker
Follow the general installation instructions
[on the Docker site](https://docs.docker.com/installation/):
Follow the general installation instructions [on the Docker site](https://docs.docker.com/install/):
* [macOS](https://docs.docker.com/installation/mac/): [docker toolbox](https://www.docker.com/toolbox)
* [Ubuntu](https://docs.docker.com/installation/ubuntulinux/)
* [macOS](https://docs.docker.com/docker-for-mac/install/)
* [Ubuntu](https://docs.docker.com/install/linux/docker-ce/ubuntu/)
* [Windows](https://docs.docker.com/docker-for-windows/install/)
## Using CLI Version of LightGBM via Docker
......@@ -34,7 +34,7 @@ lightgbm-cli \
config=lgbm.conf
```
In the above example, three volumes are [mounted](https://docs.docker.com/engine/reference/commandline/run/#mount-volume--v-read-only)
In the above example, three volumes are [mounted](https://docs.docker.com/engine/reference/commandline/run/#mount-volume--v---read-only)
from the host machine to the Docker container:
* `lgbm.conf` - task config, for example
......@@ -51,8 +51,7 @@ convert_model_language=cpp
* `model.txt` - an input file for the task, could be training data or, in this case, a pre-trained model.
* `out` - a directory to store the output of the task, notice that `convert_model` in the task config is using it.
`config=lgbm.conf` is a command-line argument passed to the `lightgbm` executable, more arguments can
be passed if required.
`config=lgbm.conf` is a command-line argument passed to the `lightgbm` executable, more arguments can be passed if required.
## Running the Python-package Сontainer
......
FROM ubuntu:16.04
RUN apt-get update && \
apt-get install -y cmake build-essential gcc g++ git && \
apt-get install -y --no-install-recommends \
cmake \
build-essential \
gcc \
g++ \
git && \
rm -rf /var/lib/apt/lists/*
RUN git clone --recursive --branch stable https://github.com/Microsoft/LightGBM && \
RUN git clone --recursive --branch stable --depth 1 https://github.com/Microsoft/LightGBM && \
mkdir LightGBM/build && \
cd LightGBM/build && \
cmake .. && \
make -j4 && \
make install && \
cd ../.. && \
rm -rf LightGBM
rm -rf LightGBM
ENTRYPOINT ["lightgbm"]
FROM ubuntu:16.04
RUN apt-get update && \
apt-get install -y cmake build-essential gcc g++ git wget && \
apt-get install -y --no-install-recommends \
cmake \
build-essential \
gcc \
g++ \
git \
wget && \
# python-package
# miniconda
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
/bin/bash Miniconda3-latest-Linux-x86_64.sh -f -b -p /opt/conda && \
export PATH="/opt/conda/bin:$PATH" && \
conda config --set always_yes yes --set changeps1 no && \
# lightgbm
conda install -y numpy scipy scikit-learn pandas && \
git clone --recursive https://github.com/Microsoft/LightGBM && \
conda install -q -y numpy scipy scikit-learn pandas && \
git clone --recursive --branch stable --depth 1 https://github.com/Microsoft/LightGBM && \
cd LightGBM/python-package && python setup.py install && \
# clean
apt-get autoremove -y && apt-get clean && \
conda clean -i -l -t -y && \
conda clean -a -y && \
rm -rf /usr/local/src/*
ENV PATH /opt/conda/bin:$PATH
......@@ -5,6 +5,6 @@ WORKDIR /lgbm
# R
RUN apt-get update && \
apt-get install -y build-essential && \
git clone --recursive --branch stable https://github.com/Microsoft/LightGBM && \
git clone --recursive --branch stable --depth 1 https://github.com/Microsoft/LightGBM && \
cd LightGBM && \
Rscript build_r.R
# Dockerfile for LightGBM GPU Version with Python
A docker file with LightGBM utilizing nvidia-docker. The file is based on the nvidia/cuda:8.0 image. LightGBM can be utilized in GPU and CPU modes and via Python (2.7 & 3.5)
A docker file with LightGBM utilizing nvidia-docker. The file is based on the `nvidia/cuda:8.0-cudnn5-devel` image.
LightGBM can be utilized in GPU and CPU modes and via Python (2.7 & 3.6).
## Contents
- LightGBM (cpu + gpu)
- Python 2.7 (Conda) + scikit-learn notebooks pandas matplotlib
- Python 3.5 (Conda) + scikit-learn notebooks pandas matplotlib
- Python 2.7 (conda) + scikit-learn, notebooks, pandas, matplotlib
- Python 3.6 (conda) + scikit-learn, notebooks, pandas, matplotlib
Running the container starts a jupyter notebook at localhost:8888
Running the container starts a Jupyter Notebook at `localhost:8888`.
jupyter password: keras
Jupyter password: `keras`.
## Requirements
......
......@@ -31,11 +31,11 @@ RUN chmod +x /tini
#################################################################################################################
# SYSTEM
#################################################################################################################
# update: downloads the package lists from the repositories and "updates" them to get information on the newest versions of packages and their
# dependencies. It will do this for all repositories and PPAs.
# update: downloads the package lists from the repositories and "updates" them to get information on the newest versions of packages and their
# dependencies. It will do this for all repositories and PPAs.
RUN apt-get update && \
apt-get install -y \
apt-get install -y --no-install-recommends \
build-essential \
curl \
wget \
......@@ -70,44 +70,45 @@ ENV PATH $CONDA_DIR/bin:$PATH
# Install miniconda
RUN echo 'export PATH=/opt/conda/bin:$PATH' > /etc/profile.d/conda.sh && \
wget --quiet https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh
RUN conda create -q -n py2 python=2.7 mkl numpy scipy scikit-learn jupyter notebook ipython pandas matplotlib
RUN conda create -q -n py3 python=3.5 mkl numpy scipy scikit-learn jupyter notebook ipython pandas matplotlib
RUN conda config --set always_yes yes --set changeps1 no && \
conda create -y -q -n py2 python=2.7 mkl numpy scipy scikit-learn jupyter notebook ipython pandas matplotlib && \
conda create -y -q -n py3 python=3.6 mkl numpy scipy scikit-learn jupyter notebook ipython pandas matplotlib
#################################################################################################################
# LightGBM
#################################################################################################################
RUN cd /usr/local/src && mkdir lightgbm && cd lightgbm && \
git clone --recursive https://github.com/microsoft/LightGBM && \
git clone --recursive --branch stable --depth 1 https://github.com/microsoft/LightGBM && \
cd LightGBM && mkdir build && cd build && \
cmake -DUSE_GPU=1 -DOpenCL_LIBRARY=/usr/local/cuda/lib64/libOpenCL.so -DOpenCL_INCLUDE_DIR=/usr/local/cuda/include/ .. && \
cmake -DUSE_GPU=1 -DOpenCL_LIBRARY=/usr/local/cuda/lib64/libOpenCL.so -DOpenCL_INCLUDE_DIR=/usr/local/cuda/include/ .. && \
make OPENCL_HEADERS=/usr/local/cuda-8.0/targets/x86_64-linux/include LIBOPENCL=/usr/local/cuda-8.0/targets/x86_64-linux/lib
ENV PATH /usr/local/src/lightgbm/LightGBM:${PATH}
RUN /bin/bash -c "source activate py2 && cd /usr/local/src/lightgbm/LightGBM/python-package && python setup.py install --precompile && source deactivate"
RUN /bin/bash -c "source activate py3 && cd /usr/local/src/lightgbm/LightGBM/python-package && python setup.py install --precompile && source deactivate"
#################################################################################################################
# System CleanUp
#################################################################################################################
# apt-get autoremove: used to remove packages that were automatically installed to satisfy dependencies for some package and that are no more needed.
# apt-get clean: removes the aptitude cache in /var/cache/apt/archives. You'd be amazed how much is in there! the only drawback is that the packages
# apt-get clean: removes the aptitude cache in /var/cache/apt/archives. You'd be amazed how much is in there! the only drawback is that the packages
# have to be downloaded again if you reinstall them.
RUN apt-get autoremove -y && apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
conda clean -i -l -t -y
conda clean -a -y
#################################################################################################################
# JUPYTER
# JUPYTER
#################################################################################################################
# password: keras
# password: keras
# password key: --NotebookApp.password='sha1:98b767162d34:8da1bc3c75a0f29145769edc977375a373407824'
# Add a notebook profile.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment