Docker image include android sdk for building Ionic CLI v5 application
build_frontend_apk:
stage: build_fe
image: chiticariu/ionic5
script:
- "cd <Ionic Project Directory>"
- "npm i -g npm-upgrade"
- "npm install"
- "mkdir www"
- "yes | /opt/android-sdk/tools/bin/sdkmanager --licenses || true"
- "ionic cordova build --release --prod android"
- "cd ../.."
- "mkdir publish_fe"
- "cp <Ionic Project Directory>/platforms/android/app/build/outputs/apk/release/*.apk publish_fe/"
artifacts:
paths:
- publish_fe/*.apk
when: manual
If you want to run or build the ionic project in computer but doesn't have Android Studio, Android SDK or Ionic Framework and this computer installed Docker. You can use helper command
- Restore npm package
Linux: docker run --rm -v $(pwd):/myApp chiticariu/ionic5 npm install
Windows: docker run --rm -v %cd%:/myApp chiticariu/ionic5 npm install
- Run docker image in terminal having the code mounted
Linux: docker run -it -v $(pwd):/ionic_project chiticariu/ionic5 /bin/bash
Windows: docker run -it -v %cd%:/ionic_project chiticariu/ionic5 /bin/bash
- Preview Ionic web app in your web browser
Linux: docker run --rm -v $(pwd):/myApp -p 8100:8100 chiticariu/ionic5 ionic serve
Windows: docker run --rm -v %cd%:/myApp -p 8100:8100 chiticariu/ionic5 ionic serve
- Build android apk output file
Linux: docker run --rm -v $(pwd):/myApp chiticariu/ionic5 ionic cordova build android
Windows: docker run --rm -v %cd%:/myApp chiticariu/ionic5 ionic cordova build android
References: