Skip to content

Well-defined Docker images and Make targets #258

@baldassarreFe

Description

@baldassarreFe

At present, there is a bit of confusion between the Docker image and the Makefile. In short:

  • the regular Dockerfile installs dev dependencies
  • the Development-Dockerfile installs all that the regular does (note: the install commands are duplicated, we are not using the FROM command), plus Jupyter
  • the run target in the Makefile relies on the openmined/pysyft image from DockerHub, but once the container is up, it tries to start a notebook server and fails
  • the custom target does the exact same things as the run, with the difference that it accepts an image as a parameter, so that one can build his own dev image based on Development-Dockerfile (with Jupyter) and make it work

From my point of view (close-to-zero experience with this kind of deployments), we should have two images on DockerHub:

  • openmined/pysyft that ships without dev dependencies (e.g. no gmp-dev and mpfr-dev) and with a working installation of PySyft, based either on a PyPi package or simply installed via git checkout tags/working-release && python3 setup.py install (this is to develop some application with PySyft)
  • openmined/pysyft-dev that has all the additional dependencies and uses the src folder as source for the PySyft modules (this is to develop PySyft itself)

Regarding the Makefile, I suggest keeping the test and install targets docker agnostic, meaning that if they are run on the local machine they use what's available locally and if they are used inside the container they use the container:

install: 
    python3 setup.py install

test: 
   pytest && pytest --flake8

image = openmined/pysyft
docker: 
    docker run --it $(image) ...

image-dev = openmined/pysyft-dev
docker-dev: 
    docker run --it $(image-dev) ... jupyter notebook

Examples:

  • run tests locally: make install && make test
  • run tests in docker make docker-dev make test
  • build a different image and use it with docker: docker build -f MyDockerfile -t MyImage && make docker image=MyImage

Provided that this structure will need refinement and additional details, does it make sense in general?
Can someone with experience suggest improvements?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions