Skip to content

Instantly share code, notes, and snippets.

@zanona
Last active September 22, 2020 12:06
Show Gist options
  • Save zanona/1d25e3c1977961b1abf08659298bea0b to your computer and use it in GitHub Desktop.
Save zanona/1d25e3c1977961b1abf08659298bea0b to your computer and use it in GitHub Desktop.
react-native android development makefile
#FROM=reactnativecommunity/react-native-android
FROM=reactnativeci/android-base
docker-run = @ touch .env && docker run\
--name rn\
--network host\
--privileged\
--volume /dev/bus/usb:/dev/bus/usb\
--volume opt:/opt/android\
--volume npm:/root/.npm/\
--volume android:/root/.android\
--volume gradle:/root/.gradle\
--volume $$(pwd):/home/app\
--workdir=/home/app\
--env-file=.env\
--rm\
-it $(FROM) $1\
|| docker exec -it rn '$1'
install:
$(call docker-run,bash -c "npm i --prefer-offline")
start: install
$(call docker-run,bash -c "npx react-native run-android && npx react-native start --reset-cache")
edit:
$(call docker-run,bash)
clean:
$(call docker-run,bash -c "rm -rf android/.gradle android/app/build/ node_modules/")
docker volume rm opt android gradle npm
.PHONY: install start edit clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment