Docker Deployment¶
Takeaway
Docker in the command line
Docker in desktop GUI
Dockerfile -> Docker Image -> Docker Container
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.Navigate to the directory where Dockerfile stays. Dockerfile has been set up and tested already so you don’t need to set it manually.
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 whiletest
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.Open Docker Desktop. Now, in Images section, the created docker image is in the list.
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.
Navigate to Containers section, you would see the corresponding docker container
geopi-testing
is activated.Now, you can click the running container, and navigate to its terminal. Use
ls
to check whether the code is inside or not.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.
CLI version: Use the command
python start_cli_pipeline.py
to test our command-line-interface (CLI) software.
Backend server: Launch the backend server as well by using
python start_dash_pipeline.py
.
Until now, you can copy the address http://0.0.0.0:8000 shown in the above picture and open it in the browser.
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.
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.
Now Navigate to the directory frontend, use
yarn start
to activate the frontend server.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.
After registeration, you can enter the home page. Hooray!