Giter Site home page Giter Site logo

tobias-theobald / ionic-build-android-ci-docker Goto Github PK

View Code? Open in Web Editor NEW
14.0 4.0 22.0 5 KB

All tools required to build an android APK out of an ionic project for use in CI systems

Home Page: https://hub.docker.com/r/tobitheo/ionic-build-android-ci-docker/

License: MIT License

ionic-build-android-ci-docker's Introduction

ionic-build-android-ci-docker

Attention! This project is no longer maintained. Feel free to fork it and make necessary modifications for your project.

This image provides all tools required to automatically build and Android app out of your ionic (and possibly also cordova) project.

It is primarily meant to be run in a CI environment, such as Gitlab CI, but can certainly also be used to run the compilation process on any machine capable of running docker without having to go through the process of setting everything up.

CI Configuration

Here is a sample .gitlab-ci.yml file for setting up the project and compiling it:

image: tobitheo/ionic-build-android-ci-docker:latest

compile_android:
  stage: build
  script:
    - cp debug.keystore ~/.android/debug.keystore
    - npm install
    - bower install --allow-root
    - ionic config build
    - ionic state restore
    - ionic build android

It is important to manage your keystores correctly. For signing debug releases, the android build tools will automatically fall back to ~/.android/debug.keystore, which should not be password protected.

.gitignore

This example assumes, that your .gitignore looks approximately like this:

node_modules/
platforms/
plugins/
www/lib/

That will avoid checking in generated files or dependencies, that will be restored using the aforementioned commands during build.

Getting the files out

Finally, you can get your compiled file out of your container. The image includes sftp, scp, rsync, sendemail with ssmtp and s3cmd, if you want to see more added, do not hesitate to send a pull request.

To send the apk in a mail, use sendemail to send the compiled APK as an attachment to yourself (using GMail):

    - sendemail -f [email protected] -t $MAIL_RCPT -s smtp.gmail.com:587 -xu $GMAIL_USER -xp $GMAIL_PASS -u "New CI build $CI_BUILD_ID" -m "Hi, \nthis is your Gitlab CI building $CI_BUILD_REPO, branch/tag $CI_BUILD_REF_NAME, commit $CI_BUILD_REF. \nThe generated APK file is attached. \nRegards, \n$CI_SERVER_NAME" -a platforms/android/build/outputs/apk/android-debug.apk

Note that GMAIL_USER, GMAIL_PASS and MAIL_RCPT are environment variables that have to be configured in the project settings -> Variables and the CI_* variables are set by the CI system and for Gitlab CI are documented here. The documentation for sendemail is here.

ionic-build-android-ci-docker's People

Contributors

tobias-theobald avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

ionic-build-android-ci-docker's Issues

Password protected keystore

Hi,

When generating a debug.keystore file, it is mandatory to define a password (which must be at least 6 characters I think).

Is there any way to define this password as an environment variable so that I can finally build automatically with his runner?

Or maybe let the docker instance create its own keystore, as it's only a debug one…

Thanks a lot

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.