Last active
February 24, 2020 10:05
-
-
Save lunastera/f518cdd0dce752ca88dfab840601bb07 to your computer and use it in GitHub Desktop.
CUDAイメージに任意のPythonを入れる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM nvidia/cuda:10.1-base-ubuntu16.04 AS base | |
ENV LANG C.UTF-8 | |
ENV PYTHON_VERSION 3.7.6 | |
ENV PATH /python/$PYTHON_VERSION:$PATH | |
# Install depenedent packages | |
RUN apt-get autoclean | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
wget \ | |
curl \ | |
make \ | |
build-essential \ | |
libreadline-dev \ | |
libncursesw5-dev \ | |
libssl-dev \ | |
libsqlite3-dev \ | |
libgdbm-dev \ | |
libbz2-dev \ | |
liblzma-dev \ | |
zlib1g-dev \ | |
uuid-dev \ | |
libffi-dev \ | |
libdb-dev | |
# Install Python | |
WORKDIR /python | |
RUN wget https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz \ | |
&& tar xvf Python-$PYTHON_VERSION.tar.xz \ | |
&& mv Python-$PYTHON_VERSION $PYTHON_VERSION \ | |
&& cd $PYTHON_VERSION \ | |
&& ./configure --enable-optimizations \ | |
&& make altinstall \ | |
&& curl -kL https://bootstrap.pypa.io/get-pip.py | python | |
RUN rm Python-$PYTHON_VERSION.tar.xz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM nvidia/cuda:10.1-base-ubuntu16.04 AS base | |
ENV LANG C.UTF-8 | |
ENV PYTHON_VERSION 3.7.6 | |
ENV PATH /python/$PYTHON_VERSION:$PATH | |
# Install depenedent packages | |
RUN apt-get autoclean | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
wget \ | |
curl \ | |
make \ | |
build-essential \ | |
libreadline-dev \ | |
libncursesw5-dev \ | |
libssl-dev \ | |
libsqlite3-dev \ | |
libgdbm-dev \ | |
libbz2-dev \ | |
liblzma-dev \ | |
zlib1g-dev \ | |
uuid-dev \ | |
libffi-dev \ | |
libdb-dev | |
# Install Python | |
WORKDIR /python | |
RUN wget https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz \ | |
&& tar xvf Python-$PYTHON_VERSION.tar.xz \ | |
&& mv Python-$PYTHON_VERSION $PYTHON_VERSION \ | |
&& cd $PYTHON_VERSION \ | |
&& ./configure --enable-optimizations \ | |
&& make altinstall \ | |
&& curl -kL https://bootstrap.pypa.io/get-pip.py | python | |
RUN rm Python-$PYTHON_VERSION.tar.xz | |
### Stage 2 | |
FROM base AS main | |
WORKDIR /app | |
RUN pip install poetry | |
COPY . ./ | |
RUN poetry config virtualenvs.create false && poetry install | |
CMD ["/bin/bash"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment