2 minute read

Making the script for Window Users

This was done so as to make the application truly cross-platform for all the users using the Windows.However it is important to note there are few prequesites before using this app in windows

  • You must have docker daemon running in the background
  • Your machine must have minimum 16gb RAM.

In this week, I successfully built the Electron app in the out folder. However, to run the app, we previously needed to run the backend via the Docker image. This was a manual process that required the user to have Docker installed and to know how to use it.

To make the process more user-friendly, I created a script that Works for window users. The script first checks if Docker is installed. If it is, the script then searches for the Dockerfile. If the Dockerfile doesn’t exist, the script pulls the Docker image from the registry. Otherwise, the script runs the Docker image.

This script significantly reduces the number of steps that the user has to follow to run the app. Now, the user can simply run the script and the app will be deployed automatically.

Here are some of the technical details of the script:

  • The script is written in batch.
  • The script checks if Docker is installed by running the docker command.
  • The script searches for the Dockerfile by looking for the file Dockerfile in the current directory.
  • The script pulls the Docker image from the registry by running the command docker pull jderobot/robotics-academy.
  • The script runs the Docker image by running the command :

    start /b docker run --rm -it -p 8000:8000 -p 2303:2303 -p 1905:1905 -p 8765:8765 -p 6080:6080 -p 1108:1108 -p 7163:7163 %image_name%start /b  docker run --rm -it -p 8000:8000 -p 2303:2303 -p 1905:1905 -p 8765:8765 -p 6080:6080 -p 1108:1108 -p 7163:7163 %image_name%
    

Work Done

Learnings

  • The importance of automation. The script that I created automates the deployment of the Electron app. This makes the process much more user-friendly and reduces the number of steps that the user has to follow in the windows as well which previously was done by using multiple steps where in for a windows user they had to first run docker daemon then pull the image and then run the container all of it was just to run the backend.but now its been made more easy and efficient.

  • The power of Docker. Docker is a powerful tool that can be used to automate the deployment of applications. The script that I created uses Docker to pull and run the Docker image for the Electron app.

  • The importance of testing. I tested the script extensively to make sure that it was working properly. This helped me to identify and fix any errors in the script.

  • Scripts : The process of writing scripts in windows using batch was a learning process and task , learned so much how we can write scripts and what are the differences while writing scripts for bash and for batch.

Plan for Next week

  • Documentation for running the Application both in Windows as well as in Linux/MacOS.

Categories:

Updated: