Docker Deployment

Takeaway

  • Docker in the command line

  • Docker in desktop GUI

  • Dockerfile -> Docker Image -> Docker Container

  1. Search how to download Docker in your computer. Meanwhile, you will get a command line tool called docker. Use docker --version to check whether it exists on VSCode console.

    image

  2. Navigate to the directory where Dockerfile stays. Dockerfile has been set up and tested already so you don’t need to set it manually.

    image

  3. Use docker build to make a docker image. The command is might different on Windows. No worries, just search it on the internet. In the command below, geopi is the name of the docker image while test is the tag of the docker image. For the first time to execute the command, it needs longer time than that of mine shown below and looks slightly different. Sometimes, It would fail because the stability of the network. If it fails, just rerun the command until it works.

    image

  4. Open Docker Desktop. Now, in Images section, the created docker image is in the list.

    image

    Click the run button as shown above to configure the docker image when you want to initialize the corresponding docker container. Then, you simple input the container name and host ports as shown below, click run and wait until it finishes.

    image

  5. Navigate to Containers section, you would see the corresponding docker container geopi-testing is activated.

    image

    Now, you can click the running container, and navigate to its terminal. Use ls to check whether the code is inside or not.

    image

  6. The difference between Local Deployment and Docker Deployment is that we have set up the commands to download related dependencies for you. Hence, you can test CLI version, frontend and backend server directly. For more manual download detail, please refer to Local Deployment.

    1. CLI version: Use the command python start_cli_pipeline.py to test our command-line-interface (CLI) software.

    image

    1. Backend server: Launch the backend server as well by using python start_dash_pipeline.py.

    image

    Until now, you can copy the address http://0.0.0.0:8000 shown in the above picture and open it in the browser.

    image

    This indicates that the backend server works normally.

    Besides, you can append the suffix /docs to the backend server address http://0.0.0.0:8000 to make http://0.0.0.0:8000/docs. Then use this address to open our API interface in the browser.

    image

    1. Frontend server: This time, we need to open a external terminal by clicking in Docker Desktop. Because, we use frontend and backend seperation mode to construct our web portal. To utilize the functionality in the web page, you need to activate frontend and backend servers simultaneously.

    image

    image

    Now Navigate to the directory frontend, use yarn start to activate the frontend server.

    image

    you can copy the address http://localhost:3001/ shown in the above picture and open it in the browser. And then navigate to the registration page to register firstly.

    image

    After registeration, you can enter the home page. Hooray!

    image