angle-left Eclipse che

How to create a Dockerfile?

When you create a workspace using Eclipse che and generate the project template using the script initTemplate.sh, you can find in the root of the project a file named Dockerfile. This file is needed to create docker image.

What is Docker?

 Docker is a containerization platform. Containerization is a way to package units of code with their dependencies so that they have everything they need to run in isolation.

Using Docker can help fix the "it works on my machine" problem, and writing dockerized code is a great way to encourage thoughtful code practices. Docker containers should be simple, responsible for as little as possible, and dependent on as few externals as possible.

In the platform, docker images of algorithms are created to help users to run algorithms without accessing to Eclipse che, or Jupyter.

Create a Dockerfile?

In the template generated, you have a template of a Dockerfile

#FROM is the source image. This source image contains by default many scientific libraries (Read Processing stack contents for more details)

FROM kosted/bmap-stack

#For each library you installed manually, add it in the file with the command RUN. For example :

RUN pip3 install property

 #To keep the hierarchy as in Eclipse che, change the path with the name of your project. All files will be copied inside
WORKDIR /projects/{THE-NAME-OF-YOUR-PROJECT}

#With the command "ADD ." all files and folders you created will be copied inside the Docker image in the path you specified
ADD . /projects/{THE-NAME-OF-YOUR-PROJECT}

#Entrypoint sets the command and parameters that will be executed first when the Docker image is run

ENTRYPOINT  ["python3", "/projects/{THE-NAME-OF-YOUR-PROJECT}/src/sampleExample.py"]

48 Views
Average (0 Votes)