├── demo-video.gif ├── .gitignore ├── Dockerfile ├── LICENSE └── readme.md /demo-video.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oren/docker-cordova/HEAD/demo-video.gif -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .bash_history 2 | .node-gyp 3 | .npm 4 | node_modules 5 | .md 6 | .pki 7 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM kallikrein/cordova:5.1.1 2 | 3 | MAINTAINER Thomas Charlat 4 | RUN \ 5 | apt-get update && \ 6 | apt-get install -y lib32stdc++6 lib32z1 7 | 8 | # download and extract android sdk 9 | RUN curl http://dl.google.com/android/android-sdk_r24.2-linux.tgz | tar xz -C /usr/local/ 10 | ENV ANDROID_HOME /usr/local/android-sdk-linux 11 | ENV PATH $PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools 12 | 13 | # update and accept licences 14 | 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; \ 15 | find /usr/local/android-sdk-linux -perm 0744 | xargs chmod 755 16 | 17 | ENV GRADLE_USER_HOME /src/gradle 18 | VOLUME /src 19 | WORKDIR /src 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Docker container for Cordova development 2 | 3 | ![docker-badge](http://dockeri.co/image/oreng/cordova) 4 | 5 | ![demo-video](demo-video.gif) 6 | 7 | ## Content 8 | 9 | * [why](#why) 10 | * [Setup](#setup) 11 | * [New Project](#new-project) 12 | * [Useful commands](#useful-commands) 13 | * [References](#references) 14 | 15 | ## Why? 16 | 17 | I don't want to install and configure Java, Android SDK, Ant, cordova etc.. life is too short. 18 | 19 | ## Setup 20 | 21 | git clone git@github.com:oren/docker-cordova.git 22 | cd docker-cordova 23 | docker build -t cordova . 24 | alias mine='sudo chown -R $USER' 25 | alias drun='docker run -it --rm' 26 | alias cordova='drun --privileged -v /dev/bus/usb:/dev/bus/usb -v $PWD:/src cordova cordova' 27 | 28 | The alias command lets you use `cordova` for running any command inside the cordova container. 29 | 30 | ## New Project 31 | 32 | cordova create hello 33 | cd hello 34 | cordova platform add android 35 | cordova build 36 | 37 | Connect your android device to your laptop with a usb 38 | 39 | cordova run android 40 | 41 | That's it, your app should be on your phone! 42 | 43 | ## Useful commands 44 | 45 | ### List of attached devices 46 | 47 | Make sure you see your phone in that list. 48 | 49 | docker run --rm -i -v $(pwd):/workspace -w /workspace \ 50 | --privileged -v /dev/bus/usb:/dev/bus/usb cordova adb devices 51 | 52 | ### Run with different user 53 | 54 | To ensure the container uses the same user id as the caller use the 55 | -u option and provide a writeable HOME directory to that user (change the alias if necessary!) 56 | 57 | alias cordova='docker run --rm -i -u `id -u` -v $PWD:/src -e "HOME=/tmp" cordova cordova' 58 | 59 | ## References 60 | 61 | The image is based on https://github.com/Kallikrein/dockerfiles/tree/master/android-cordova~/projects/myAPP 62 | --------------------------------------------------------------------------------