github.com/apptainer/singularity@v3.1.1+incompatible/examples/legacy/2.2/contrib/ubuntu16-tensorflow-0.12.1.def (about)

     1  # Defines a Singularity container with TensorFlow pre-installed
     2  #
     3  
     4  BootStrap: docker
     5  From: ubuntu:16.04
     6  
     7  
     8  %runscript
     9      # When executed, the container will run Python with the TensorFlow module
    10  
    11      exec /usr/bin/python "$@"
    12  
    13  
    14  %post
    15      # Runs within the container during Bootstrap
    16  
    17      # Set up some required environment defaults
    18      export LC_ALL=C
    19      export PATH=/bin:/sbin:/usr/bin:/usr/sbin:$PATH
    20  
    21      # Install the necessary packages (from repo)
    22      apt-get update && apt-get install -y --no-install-recommends \
    23          build-essential \
    24          curl \
    25          git \
    26          libcurl3-dev \
    27          libfreetype6-dev \
    28          libpng12-dev \
    29          libzmq3-dev \
    30          python-pip \
    31          pkg-config \
    32          python-dev \
    33          rsync \
    34          software-properties-common \
    35          unzip \
    36          zip \
    37          zlib1g-dev
    38      apt-get clean
    39  
    40      # Update to the latest pip (newer than repo)
    41      pip install --no-cache-dir --upgrade pip
    42      
    43      # Install other commonly-needed packages
    44      pip install --no-cache-dir --upgrade \
    45          future \
    46          matplotlib \
    47          scipy \
    48          sklearn
    49  
    50      # TensorFlow package versions as listed here:
    51      #   https://www.tensorflow.org/get_started/os_setup#test_the_tensorflow_installation
    52      #
    53      # Ubuntu/Linux 64-bit, CPU only, Python 2.7
    54      export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp27-none-linux_x86_64.whl
    55      pip install --no-cache-dir --ignore-installed --upgrade $TF_BINARY_URL
    56  
    57  
    58  %test
    59      # Sanity check that the container is operating
    60  
    61      # Ensure that TensorFlow can be imported
    62      /usr/bin/python -c "import tensorflow as tf"
    63  
    64      # Runs in less than 30 minutes on low-end CPU
    65      /usr/bin/python -m tensorflow.models.image.mnist.convolutional
    66