2

I want to write an interactive tutorial to teach a team how to use Typescript and Angular 2, but I don't want everyone to install Jupyter.

So, I want to build a docker image that has everything needed.

This is my Dockerfile so far, but I am not certain where to copy the package.json from Quickstart so npm install will find it, do the installation and have Jupyter find it.

FROM jupyter/minimal-notebook

MAINTAINER Jupyter Project <jupyter@googlegroups.com>

USER root

RUN apt-get update && \
    apt-get install -y --no-install-recommends && \
    apt-get install -y npm nodejs nodejs-legacy wget locales git \
    fonts-dejavu \
    gcc && apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN npm install --save jupyter-js-plugins    

USER $NB_USER

I want to add this plugin from github for Typescript.

Another option is to just copy the files to the docker image, but where would they be copied in order to be found by Jupyter?

James Black
  • 41,583
  • 10
  • 86
  • 166
  • `ADD` can pickup from url which is github in your case. Or curl with Run or [this](http://stackoverflow.com/questions/32189877/creating-a-docker-image-for-a-github-project) should be of help. – Rao Nov 01 '16 at 06:24
  • @Rao - I may try your idea as I ran into a problem where the plugin isn't installed, but everything is loaded. I may just need to build my own docker container and not start with one where Jupyter is installed. – James Black Nov 02 '16 at 00:09

2 Answers2

2

You can copy the package.json anywhere as long as you set the WORKDIR before running NPM install.

COPY . /src
WORKDIR /src
RUN npm install
JayChase
  • 11,174
  • 2
  • 43
  • 52
1

The Dockerfile you're extending from uses /home/$NB_USER/work as WORKDIR. The env variable NB_USER is set to joyvan in the base Dockerfile

If you copy your files like this

COPY . /home/$NB_USER/work/

you should be fine.

I'm not sure how easy it would be to override the env variable, because it is already used when building the images. You're probably better off to just define your own WORKDIR in your Dockerfile like @JayChase mentioned.

Community
  • 1
  • 1
cringe
  • 13,401
  • 15
  • 69
  • 102