Giter VIP home page Giter VIP logo

docker-cordova's Introduction

Docker container for Cordova development

docker-badge

demo-video

Content

Why?

I don't want to install and configure Java, Android SDK, Ant, cordova etc.. life is too short.

Setup

git clone [email protected]:oren/docker-cordova.git
cd docker-cordova
docker build -t cordova .
alias mine='sudo chown -R $USER'
alias drun='docker run -it --rm'
alias cordova='drun --privileged -v /dev/bus/usb:/dev/bus/usb -v $PWD:/src cordova cordova'

The alias command lets you use cordova for running any command inside the cordova container.

New Project

cordova create hello
cd hello
cordova platform add android
cordova build

Connect your android device to your laptop with a usb

cordova run android

That's it, your app should be on your phone!

Useful commands

List of attached devices

Make sure you see your phone in that list.

docker run --rm -i -v $(pwd):/workspace -w /workspace \
    --privileged -v /dev/bus/usb:/dev/bus/usb cordova adb devices

Run with different user

To ensure the container uses the same user id as the caller use the -u option and provide a writeable HOME directory to that user (change the alias if necessary!)

alias cordova='docker run --rm -i -u `id -u` -v $PWD:/src -e "HOME=/tmp" cordova cordova'

References

The image is based on https://github.com/Kallikrein/dockerfiles/tree/master/android-cordova~/projects/myAPP

docker-cordova's People

Contributors

ascheman avatar oren avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-cordova's Issues

cannot find underscore.js with cordova-5.1.1

The strange thing is that the docker base implied it is cordova 5.1.1, but by default, cordova 4.0.2 is used.

$ cordova="docker run -it --rm --privileged -v /dev/bus/usb:/dev/bus/usb -v $PWD:/src cordova cordova"
$ $cordova platform add [email protected]
npm http GET https://registry.npmjs.org/cordova-android
npm http 200 https://registry.npmjs.org/cordova-android
npm http GET https://registry.npmjs.org/cordova-android
npm http 200 https://registry.npmjs.org/cordova-android
npm http GET https://registry.npmjs.org/cordova-android/-/cordova-android-5.1.1.tgz
npm http 200 https://registry.npmjs.org/cordova-android/-/cordova-android-5.1.1.tgz
Adding android project...
module.js:338
    throw err;
          ^
Error: Cannot find module 'underscore'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/root/.cordova/lib/npm_cache/cordova-android/5.1.1/package/node_modules/cordova-common/src/superspawn.js:23:9)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
Error: /root/.cordova/lib/npm_cache/cordova-android/5.1.1/package/bin/create: Command failed with exit code 1
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)
    at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

certificate not trusted

Hello,
I can run cordova create hello, cd hello, but I can't run cordova platform add android. I get "Unable to fetch platform android: Error: certificate not trusted". Can you help me? Thank you!

Ionic ?

Hey !

Is it possible to add Ionic in the container, or at least an option during the install to chose if we want ionic or not ? It could be really useful !

Anyway, thank you so much for this, I really needed that kind of automation! If only I found this before, could have easily saved 3+ hours installation. Nice work !

Reinstalling app

Hello,
Are you able to rerun an already installed app ?
I have to uninstall it on the device otherwise I have a certificate failure

Block on Step 7

Hi,

It block on step 7

Step 7 : RUN ( sleep 5 && while [ 1 ]; do sleep 1; echo y; done ) | /usr/local/android-sdk-linux/tools/android update sdk --no-ui -a --filter platform-tool,build-tools-22.0.1,android-22; find /usr/local/android-sdk-linux -perm 0744 | xargs chmod 755

I'm on macbook pro. - OS X Yosemite and docker is correctly installed

Thanks for your help ;)

cordova exits immediatly

Hii there,
I've been trying to get your image to work, but no matter what I try, after I run cordova platform add android, it just flat out exits after the telemetry consent:

finlay@Finlay-e6410:~/my-project$ cordova platform add android
? May Cordova anonymously report usage statistics to improve the tool over time? Yes

Thanks for opting into telemetry to help us improve cordova.
finlay@Finlay-e6410:~/my-project$

I've tried running some other commands, and they all share this behaviour (with exception of the help command).
Any clues why this happens?

License

Could you specify a license for this project, please?

Requires build tools version 23

I tried to follow all the steps to create a docker image and run the cordova commands on an Ubuntu machine, but a few things failed.

Most notably I received an error that i needed to install android build tools version 23.
I modified my local docker file to have 23 and it all worked.

On a side note, the "cordova platform add android" command fails because it can no longer get the android files from the npm repositories.
I had to edit the config.xml file and add the engine with version 5.1.1 and provide a URL to the git repository. Then i ran cordova prepare and that worked. Maybe you want to add this to the main page?
Or i can fork and create a PR if you'll be willing to accept.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.