DEV Community

Grégoire
Grégoire

Posted on • Originally published at gkdv.net

A docker image for your cordova and electron projects

Read the original article on GKDV

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

Top comments (0)