From 99316139e41ae9cac633e64e67df2fe955edf47f Mon Sep 17 00:00:00 2001 From: Juliano Petronetto Date: Sat, 25 Nov 2017 02:02:05 -0200 Subject: [PATCH] first commit --- Dockerfile | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ LICENSE | 29 +++++++++++++++++++++++++++++ README.md | 30 ++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 Dockerfile create mode 100644 LICENSE create mode 100644 README.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c33cba4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,53 @@ +FROM alpine:3.6 + +LABEL maintainer="Juliano Petronetto " +LABEL org.label-schema.name="PyTorch Alpine" \ + org.label-schema.description="PyTorch in Alpine Linux" \ + org.label-schema.url="https://hub.docker.com/r/petronetto/pytorch-alpine" \ + org.label-schema.vcs-url="https://github.com/petronetto/pytorch-alpine" \ + org.label-schema.vendor="Petronetto DevTech" \ + org.label-schema.version="1.0" \ + org.label-schema.schema-version="1.0" + +RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/main | tee /etc/apk/repositories \ + && echo http://dl-cdn.alpinelinux.org/alpine/edge/testing | tee -a /etc/apk/repositories \ + && echo http://dl-cdn.alpinelinux.org/alpine/edge/community | tee -a /etc/apk/repositories \ + && apk add --update --no-cache tini bash \ + curl ca-certificates python3 py3-numpy py3-numpy-f2py libstdc++ \ +## Setup de basic requeriments + && python3 -m ensurepip \ + && rm -r /usr/lib/python*/ensurepip \ + && pip3 --no-cache-dir install --upgrade pip setuptools \ + && if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip; fi \ + && if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3 /usr/bin/python; fi \ + && ln -s locale.h /usr/include/xlocale.h \ +## Dev dependencies and others stuffs... + && apk add --no-cache --virtual=.build-dependencies \ + build-base linux-headers python3-dev git cmake \ + libffi-dev openblas-dev py-numpy-dev \ + && pip install -U --no-cache-dir pyyaml pymkl cffi \ + ipywidgets notebook requests \ + && jupyter nbextension enable --py widgetsnbextension \ +## Installing PyTorch + && git clone --recursive https://github.com/pytorch/pytorch \ + && cd pytorch && python setup.py install \ +## Cleaning + && rm /usr/include/xlocale.h \ + && rm -rf /root/.cache \ + && rm -rf /var/cache/apk/* \ + && apk del .build-dependencies \ + && find /usr/lib/python3.6 -name __pycache__ | xargs rm -r \ + && rm -rf /root/.[acpw]* \ +## Run notebook without token and disable warnings + && mkdir -p /root/.jupyter \ + && echo "import warnings" >> /root/.jupyter/config.py \ + && echo "warnings.filterwarnings('ignore')" >> /root/.jupyter/config.py \ + && echo "c.NotebookApp.token = u''" >> /root/.jupyter/config.py + +EXPOSE 5000 + +WORKDIR /notebooks + +ENTRYPOINT ["/sbin/tini", "--"] + +CMD ["jupyter", "notebook", "--port=5000", "--no-browser", "--allow-root", "--ip=0.0.0.0", "--NotebookApp.token="] \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..bbb1001 --- /dev/null +++ b/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2017, Juliano Petronetto +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..c9374d0 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +``` +██████╗ ██╗ ██╗████████╗ ██████╗ ██████╗ ██████╗██╗ ██╗ +██╔══██╗╚██╗ ██╔╝╚══██╔══╝██╔═══██╗██╔══██╗██╔════╝██║ ██║ +██████╔╝ ╚████╔╝ ██║ ██║ ██║██████╔╝██║ ███████║ +██╔═══╝ ╚██╔╝ ██║ ██║ ██║██╔══██╗██║ ██╔══██║ +██║ ██║ ██║ ╚██████╔╝██║ ██║╚██████╗██║ ██║ +╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ +``` + +[![](https://images.microbadger.com/badges/image/petronetto/pytorch-alpine:latest.svg)](https://microbadger.com/images/petronetto/pytorch-alpine:latest "Get your own image badge on microbadger.com") +[![](https://images.microbadger.com/badges/version/petronetto/pytorch-alpine:latest.svg)](https://microbadger.com/images/petronetto/pytorch-alpinee:latest "Get your own version badge on microbadger.com") +[![](https://images.microbadger.com/badges/image/petronetto/pytorch-alpine.svg)](https://microbadger.com/images/petronetto/pytorch-alpine "Get your own image badge on microbadger.com") +[![GitHub issues](https://img.shields.io/github/issues/petronetto/pytorch-alpine.svg)](https://github.com/petronetto/pytorch-alpine/issues) +[![GitHub license](https://img.shields.io/github/license/petronetto/pytorch-alpine.svg)](https://raw.githubusercontent.com/petronetto/pytorch-alpine/master/LICENSE) +[![Twitter](https://img.shields.io/twitter/url/https/github.com/petronetto/pytorch-alpine.svg?style=social)](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2Fpetronetto%2Fpytorch-alpine) + + +## Running the container + +Simply run the following command and open your browser in http://localhost:5000. + +``` +docker run -it \ + -v $(PWD):/notebooks \ + -p 5000:5000 \ + petronetto/pytorch-alpine +``` + +## License +[BSD 3-Clause License](https://raw.githubusercontent.com/petronetto/pytorch-alpine/master/LICENSE) \ No newline at end of file