Skip to content

Instantly share code, notes, and snippets.

@kretes
Created September 17, 2016 07:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kretes/566d9d725891be683f5362c03dee484f to your computer and use it in GitHub Desktop.
Save kretes/566d9d725891be683f5362c03dee484f to your computer and use it in GitHub Desktop.
minimal installation of keras 1.0.8 running example code at the end
FROM nvidia/cuda:7.5-cudnn5-devel
ENV CONDA_DIR /opt/conda
ENV PATH $CONDA_DIR/bin:$PATH
RUN mkdir -p $CONDA_DIR && \
echo export PATH=$CONDA_DIR/bin:'$PATH' > /etc/profile.d/conda.sh && \
apt-get update && \
apt-get install -y wget git libhdf5-dev g++ graphviz && \
wget --quiet https://repo.continuum.io/miniconda/Miniconda3-3.9.1-Linux-x86_64.sh && \
echo "6c6b44acdd0bc4229377ee10d52c8ac6160c336d9cdd669db7371aa9344e1ac3 *Miniconda3-3.9.1-Linux-x86_64.sh" | sha256sum -c - && \
/bin/bash /Miniconda3-3.9.1-Linux-x86_64.sh -f -b -p $CONDA_DIR && \
rm Miniconda3-3.9.1-Linux-x86_64.sh
ENV NB_USER keras
ENV NB_UID 1000
RUN useradd -m -s /bin/bash -N -u $NB_UID $NB_USER && \
mkdir -p $CONDA_DIR && \
chown keras $CONDA_DIR -R && \
mkdir -p /src && \
chown keras /src
USER keras
# Python
ARG python_version=3.5.1
ARG tensorflow_version=0.9.0rc0-cp35-cp35m
RUN conda install -y python=${python_version} && \
pip install https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-${tensorflow_version}-linux_x86_64.whl && \
conda clean -yt
RUN pip install git+git://github.com/fchollet/keras.git@1.0.8
ENV PYTHONPATH='/src/:$PYTHONPATH'
WORKDIR /src
EXPOSE 8888
CMD echo "\
from keras.models import Sequential\n\
from keras.layers import Convolution2D, MaxPooling2D, Activation\n\
model = Sequential()\n\
model.add(Convolution2D(32, 3, 3, input_shape=(3, 150, 150)))\n\
model.add(Activation('relu'))\n\
model.add(MaxPooling2D(pool_size=(2, 2)))\n" | python3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment