A github template for your cordova and electron projects

February 12, 2020

Each time I need to do a little personal android project (with a light angularjs),
I have to remember how to configure android environement, cordova packages, etc.

cordova and electron docker image github template

And recently, I need to generate an electron app.
However, cordova and electron use static html rendering logic: how to make it easier?

Using docker

I created a template repository on github: electron-docker-project, which handles android and electron build, and can serve html files using nginx (because modern browsers deny ajax call on local environment).
It’s really simple to use, after you based your repository on this template:

Install

$ git clone git@github.com:gpenverne/electron-docker-project.git    
$ cd electron-docker-project    
$ make build # Build the docker image    
$ make install # Install dependencies    

Run - electron gui

$ make gui # Launch the electron gui    

Generate an android APK (cordova)

$ make android # Generate the android folders    
$ make package # Build android apk (and electron packages!)    

Serve static html ui (nginx)

$ make serve-html # Will helpfull to dev    

This docker image embed electron and android cordova dependencies:
Now, you just have to edit the config.xml file to set the android app’s name, et voilà!

cordova and electron docker image github template
Let's twitt about it!

When you click on links to various merchants on this site and make a purchase, this can result in this site earning a commission.
Affiliate programs and affiliations include, but are not limited to, the eBay Partner Network and Amazon.