Last active
November 1, 2022 03:19
-
-
Save mattbell87/24373a9d2a7387426d6a2957fc6836be to your computer and use it in GitHub Desktop.
Run a React Native Android app in Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run a react native app on docker | |
# | |
# Ensure you have enough space (>32GB) and plenty of CPU power if you're running in Codespaces | |
# | |
# 1. docker-compose up -d (or right click this file in VS code and choose Compose Up) | |
# 2. Once started go to http://localhost:6080 (or right click the dev container and choose Open in Browser in VSCode). You should see the android phone starting up | |
# 3. Log in to your container with `docker exec -it react-native-dev bash` (or right click the dev container and choose Attach Shell in VSCode) | |
# 4. Run `npm run android` to start your app (can take quite a while the first time you do this) | |
services: | |
android: | |
image: budtmo/docker-android-x86-12.0 | |
network_mode: "service:react-native-dev" | |
environment: | |
- DATAPARTITION=4g | |
privileged: true | |
depends_on: | |
- react-native-dev | |
react-native-dev: | |
image: reactnativecommunity/react-native-android | |
volumes: | |
- ./:/root/app | |
- gradle:/root/.gradle | |
working_dir: /root/app | |
command: "/bin/bash -c 'npm i && npm run start'" | |
ports: | |
- "6080:6080" #from android service | |
tty: true | |
stdin_open: true | |
container_name: react-native-dev | |
volumes: | |
gradle: | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment