Docker container with NativeScript and Android SDK. Can be used for build automation and to run a docker based development environment. The container is based on the official Ubuntu image.
- NativeScript (3.1.0)
- Android SDK Tools (25.2.5)
- Android SDK Platform (25)
- NodeJS (7.5.0)
- Java (1.8.0)
- Ubuntu (16.04 LTS)
--privileged flag will make the USB devices of your host available to the container. That way you can run your NativeScript app on a real Android device from a docker container. Please note that you need to have USB debugging enabled. The usage of an emulator is currently not possible.
my-app to your app folder location. Connect an Android device and use the following command to create and run a new NativeScript application:
docker run -it --rm --privilged \ -v /my-app/:/app \ meupatrocinio/docker-nativescript \ bash -c "tns create my-app && mv ./my-app/* ./ && rm -r ./my-app && tns platform add android && tns run android"
tns create will create a subdirectory for the application. In the example above the app folder contents will be moved up.
To setup your development environment with
docker-compose you can use the following snippet in a
You don't need a connected Android device or running emulator to build an APK. You can build an APK with only NativeScript and the Android SDK or with this docker image.
Please note that you need a release key to build a signed Android APK package with NativeScript. Look here to find out how to generate a key. Read the NativeScript documentation to learn more about building for Android.
Mount your NativeScript application root directory, the directory where the final APK should be deployed and your release key.
Execute the Debug build:
docker run --rm -it \ -v /my-app:/app \ -v /my-target-folder:/dist \ meupatrocinio/docker-nativescript \ tns build android \ --copy-to /dist/release.apk
Execute the Release build:
docker run --rm -it \ -v /my-app:/app \ -v /my-target-folder:/dist \ -v /my-release-key.jks:/key.jks \ meupatrocinio/docker-nativescript \ tns build android --release \ --key-store-path /key.jks \ --key-store-password SECRET_KEY_STORE_PASSWORD \ --key-store-alias KEY_ALIAS \ --key-store-alias-password SECRET_KEY_ALIAS_PASSWORD \ --copy-to /dist/release.apk
SECRET_KEY_ALIAS_PASSWORD with the values of your release key.
To suppress the usage statistics dialog of the
tns command you can prefix the command with the answer like that:
echo "n" | tns build android # ...
This project is licensed under the MIT license by Rafael Bernardo.
- You currently can not run your app in an Android emulator. You can only use a real device for testing with this docker image. However building for Android does't require a device or emulator.