Skip to content

Instantly share code, notes, and snippets.

@matt-slalom
Last active March 9, 2021 19:15
Show Gist options
  • Save matt-slalom/578a0c79f332ed4be40a66a9d85d3f8a to your computer and use it in GitHub Desktop.
Save matt-slalom/578a0c79f332ed4be40a66a9d85d3f8a to your computer and use it in GitHub Desktop.

Revisions

  1. matt-slalom revised this gist Mar 9, 2021. No changes.
  2. matt-slalom created this gist Mar 9, 2021.
    59 changes: 59 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,59 @@
    FROM ubuntu:20.04
    RUN rm /bin/sh && ln -s /bin/bash /bin/sh
    ENV TZ=America/Los_Angeles
    RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

    LABEL maintainer="Matt Warner <[email protected]>"

    # Install basic CLI tools etc.
    RUN apt-get update && apt-get install -y --fix-missing --no-install-recommends \
    build-essential \
    curl \
    git-core \
    iputils-ping \
    pkg-config \
    rsync \
    software-properties-common \
    unzip \
    wget \
    python3-pip

    # Install NodeJS
    RUN mkdir /usr/local/nvm
    ENV NVM_DIR /usr/local/nvm
    ENV NODE_VERSION 14.16.0
    ENV NVM_INSTALL_PATH $NVM_DIR/versions/node/v$NODE_VERSION
    RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
    RUN source $NVM_DIR/nvm.sh \
    && nvm install --lts \
    && nvm use --lts
    ENV NODE_PATH $NVM_INSTALL_PATH/lib/node_modules
    ENV PATH $NVM_INSTALL_PATH/bin:$PATH

    # Install yarn
    RUN npm install -g yarn

    # Install tfjs-node
    RUN yarn add @tensorflow/tfjs
    RUN yarn add @tensorflow/tfjs-node

    RUN pip3 install jupyterlab
    RUN npm install -g tslab
    RUN tslab install

    RUN groupadd -r jupyter
    RUN useradd -r -g jupyter -m -s /sbin/nologin jupyter
    RUN mkdir /projects
    RUN chown jupyter:jupyter /projects

    # Clean up commands
    RUN apt-get autoremove -y && apt-get clean && \
    rm -rf /usr/local/src/*

    RUN apt-get clean && \
    rm -rf /var/lib/apt/lists/*

    EXPOSE 8888
    USER jupyter
    WORKDIR "/projects"
    CMD ["/usr/local/bin/jupyter","lab","--port=8888","--ip=0.0.0.0"]