Add docker-compose for development build
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
This commit is contained in:
parent
f406feacc7
commit
31728d5493
|
@ -0,0 +1,114 @@
|
|||
|
||||
.dockerignore
|
||||
docker-build
|
||||
env/dev/env/config.cljs
|
||||
modules/react-native-status/android/build
|
||||
|
||||
|
||||
# OSX
|
||||
#
|
||||
.DS_Store
|
||||
.projectile
|
||||
.cljs_rhino_repl/
|
||||
.#*
|
||||
|
||||
# Xcode
|
||||
#
|
||||
build/
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
!default.mode1v3
|
||||
*.mode2v3
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
!default.perspectivev3
|
||||
xcuserdata
|
||||
*.xccheckout
|
||||
*.moved-aside
|
||||
DerivedData
|
||||
*.hmap
|
||||
*.ipa
|
||||
*.xcuserstate
|
||||
project.xcworkspace
|
||||
|
||||
# Android/IJ
|
||||
#
|
||||
.idea
|
||||
.gradle
|
||||
local.properties
|
||||
*.iml
|
||||
|
||||
# Atom
|
||||
.tags*
|
||||
|
||||
# node.js
|
||||
#
|
||||
node_modules/
|
||||
npm-debug.log
|
||||
.nvmrc
|
||||
|
||||
# BUCK
|
||||
buck-out/
|
||||
\.buckd/
|
||||
android/app/libs
|
||||
android/app/obj
|
||||
android/app/build
|
||||
android/build
|
||||
android/keystores/debug.keystore
|
||||
|
||||
# Generated by re-natal
|
||||
#
|
||||
index.android.js
|
||||
index.ios.js
|
||||
target/
|
||||
env/dev/env/config.cljs
|
||||
.re-natal.local
|
||||
externs/
|
||||
shim.js
|
||||
|
||||
# Generated by lein voom
|
||||
#
|
||||
/pom.xml
|
||||
|
||||
|
||||
# Figwheel
|
||||
#
|
||||
figwheel_server.log
|
||||
.nrepl-port
|
||||
|
||||
# Lein
|
||||
#
|
||||
.lein-failures
|
||||
.lein-repl-history
|
||||
|
||||
## Doo
|
||||
#
|
||||
out
|
||||
doo-index.html
|
||||
|
||||
# Re-natal
|
||||
re-natal
|
||||
|
||||
# Status
|
||||
Statusgo.framework
|
||||
status-go-local.aar
|
||||
status-dev-cli
|
||||
|
||||
#ios
|
||||
ios/Pods
|
||||
ios/StatusIm.xcworkspace
|
||||
.ruby-version
|
||||
|
||||
#python
|
||||
*.pyc
|
||||
*.cache
|
||||
|
||||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
|
||||
# screenshots whenever they are needed.
|
||||
# For more information about the recommended setup visit:
|
||||
# https://docs.fastlane.tools/best-practices/source-control/
|
||||
|
||||
*/fastlane/report.xml
|
||||
*/fastlane/Preview.html
|
||||
*/fastlane/screenshots
|
25
Makefile
25
Makefile
|
@ -1,4 +1,4 @@
|
|||
.PHONY: react-native test
|
||||
.PHONY: react-native test setup
|
||||
|
||||
help: ##@other Show this help
|
||||
@perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)
|
||||
|
@ -130,18 +130,23 @@ geth-connect: ##@other Connect to Geth on the device
|
|||
adb forward tcp:8545 tcp:8545
|
||||
build/bin/geth attach http://localhost:8545
|
||||
|
||||
android-ports: ##@other Add reverse proxy to Android Device/Simulator
|
||||
adb reverse tcp:8081 tcp:8081
|
||||
adb reverse tcp:3449 tcp:3449
|
||||
adb reverse tcp:4567 tcp:4567
|
||||
android-ports-avd: ##@other Add reverse proxy to Android Device/Simulator
|
||||
adb -e reverse tcp:8081 tcp:8081
|
||||
adb -e reverse tcp:3449 tcp:3449
|
||||
adb -e reverse tcp:4567 tcp:4567
|
||||
|
||||
android-ports-real: ##@other Add reverse proxy to Android Device/Simulator
|
||||
adb -d reverse tcp:8081 tcp:8081
|
||||
adb -d reverse tcp:3449 tcp:3449
|
||||
adb -d reverse tcp:4567 tcp:4567
|
||||
|
||||
|
||||
startdev-%:
|
||||
$(eval SYSTEM := $(word 2, $(subst -, , $@)))
|
||||
$(eval DEVICE := $(word 3, $(subst -, , $@)))
|
||||
if [[ "$(SYSTEM)" == "android" ]]; then\
|
||||
${MAKE} prepare && ${MAKE} android-ports; \
|
||||
else \
|
||||
${MAKE} prepare-ios; \
|
||||
fi
|
||||
case "$(SYSTEM)" in \
|
||||
"android") ${MAKE} prepare && ${MAKE} android-ports-$(DEVICE);; \
|
||||
"ios") ${MAKE} prepare-ios;; \
|
||||
esac
|
||||
${MAKE} dev-$(SYSTEM)-$(DEVICE)
|
||||
${MAKE} -j2 react-native repl-$(SYSTEM)
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
FROM openjdk:8-jdk
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
ENV ANDROID_HOME /opt/android-sdk-linux
|
||||
ENV PATH ${PATH}:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools:${PATH}:${ANDROID_HOME}/tools
|
||||
ENV ANDROID_NDK /opt/android-ndk-linux
|
||||
ENV ANDROID_NDK_HOME /opt/android-ndk-linux
|
||||
|
||||
WORKDIR /opt
|
||||
|
||||
RUN mkdir -p /opt/android-sdk-linux && mkdir -p ~/.android && touch ~/.android/repositories.cfg
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get update && \
|
||||
apt-get install -yq supervisor curl unzip wget sudo maven libc6 libstdc++6 zlib1g libncurses5 make file --no-install-recommends && \
|
||||
apt-get clean
|
||||
|
||||
RUN cd /opt/android-sdk-linux && \
|
||||
wget -q --output-document=sdk-tools.zip https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip && \
|
||||
unzip sdk-tools.zip && \
|
||||
rm -f sdk-tools.zip && \
|
||||
sdkmanager "cmake;3.6.4111459"
|
||||
|
||||
RUN cd /opt/android-sdk-linux && \
|
||||
wget -q --output-document=sdk-platform-tools.zip 'https://dl.google.com/android/repository/platform-tools-latest-linux.zip' && \
|
||||
unzip sdk-platform-tools.zip && \
|
||||
rm -f sdk-platform-tools.zip
|
||||
|
||||
RUN wget -q --output-document=android-ndk.zip https://dl.google.com/android/repository/android-ndk-r15c-linux-x86_64.zip && \
|
||||
unzip android-ndk.zip && \
|
||||
rm -f android-ndk.zip && \
|
||||
mv android-ndk-r15c android-ndk-linux
|
||||
|
||||
RUN yes | sdkmanager --licenses
|
||||
|
||||
# install Node JS (https://github.com/nodejs/docker-node/blob/90d5e3df903b830d039d3fe8f30e3a62395db37e/7.5/Dockerfile)
|
||||
|
||||
RUN groupadd --gid 1000 node \
|
||||
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node
|
||||
|
||||
ENV NPM_CONFIG_LOGLEVEL info
|
||||
# that's the only version that doesn't hang on installing react-native-http inside docker
|
||||
ENV NODE_VERSION 8.9.1
|
||||
ENV NODE_ENV development
|
||||
|
||||
RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \
|
||||
&& tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 \
|
||||
&& rm "node-v$NODE_VERSION-linux-x64.tar.xz" \
|
||||
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs
|
||||
|
||||
# END install Node JS
|
||||
|
||||
# Support Gradle
|
||||
ENV TERM dumb
|
||||
|
||||
# Install Lein
|
||||
# Check out latest releases from https://github.com/technomancy/leiningen/releases
|
||||
ENV LEIN_VERSION=2.8.1
|
||||
ENV LEIN_INSTALL=/usr/local/bin/
|
||||
|
||||
RUN mkdir -p $LEIN_INSTALL \
|
||||
&& wget -q https://raw.githubusercontent.com/technomancy/leiningen/$LEIN_VERSION/bin/lein-pkg \
|
||||
&& mv lein-pkg $LEIN_INSTALL/lein \
|
||||
&& chmod 0755 $LEIN_INSTALL/lein \
|
||||
&& wget -q https://github.com/technomancy/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.zip \
|
||||
&& mkdir -p /usr/share/java \
|
||||
&& mv leiningen-$LEIN_VERSION-standalone.zip /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar
|
||||
|
||||
# Install React-Native
|
||||
RUN npm install -g react-native-cli
|
||||
|
||||
# Add files needed for installing dependencies
|
||||
# Use directory /build for that purpose
|
||||
WORKDIR /build
|
||||
|
||||
ADD .env.jenkins .env
|
||||
|
||||
ADD ./project.clj ./
|
||||
|
||||
RUN lein deps
|
||||
|
||||
ADD ./package.json package-lock.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
ADD . ./
|
||||
|
||||
RUN make setup
|
||||
RUN make prepare
|
||||
|
||||
COPY supervisord.conf /etc/supervisord.conf
|
||||
|
||||
RUN keytool -genkey -v -keystore status-im.keystore -storepass password -alias status -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=mqttserver.ibm.com, OU=ID, O=IBM, L=Hursley, S=Hants, C=GB" -keypass password
|
||||
RUN mkdir -p /root/.gradle
|
||||
RUN mv status-im.keystore /root/.gradle/
|
||||
|
||||
RUN ./android/gradlew --parallel -q -b android/build.gradle assembleRelease
|
||||
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
|
|
@ -0,0 +1,37 @@
|
|||
# Build
|
||||
|
||||
```
|
||||
docker-compose -f docker-build/docker-compose.yml build
|
||||
```
|
||||
|
||||
This will install all the required sdks, depending on the connection will take some time.
|
||||
|
||||
# Run
|
||||
|
||||
```
|
||||
docker-compose -f docker-build/docker-compose.yml up
|
||||
```
|
||||
|
||||
This will start `adbd` and `fighwheel` listening on port `4567`.
|
||||
|
||||
You need to connect your device and accept the key.
|
||||
|
||||
After the figwheel prompt you can install the application running:
|
||||
|
||||
```
|
||||
docker-compose -f docker-build/docker-compose.yml exec adbd make run-android
|
||||
```
|
||||
|
||||
# Notes
|
||||
|
||||
## Adbd key
|
||||
|
||||
The adbd key is generated every time you start/stop the container, so you will have to accept it if that happens.
|
||||
|
||||
## Security
|
||||
|
||||
This will give the docker image access to your USB devices and run in priviliged mode, so run at your own risk.
|
||||
|
||||
## Multiple adbd
|
||||
|
||||
You will need to make sure no `adbd` is running on your local machine, as that would interfer with the one running in docker.
|
|
@ -0,0 +1,15 @@
|
|||
version: '3'
|
||||
services:
|
||||
adbd:
|
||||
privileged: true
|
||||
build:
|
||||
context: $PWD
|
||||
dockerfile: docker-build/Dockerfile
|
||||
ports:
|
||||
- 4567:4567
|
||||
volumes:
|
||||
- /dev/bus/usb:/dev/bus/usb
|
||||
- ../src:/build/src
|
||||
- ../test:/build/test
|
||||
- ../android/app/src/:/build/android/app/src
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
[supervisord]
|
||||
nodaemon = true
|
||||
|
||||
[program:fighweel]
|
||||
command = make startdev-android-real
|
||||
autorestart = true
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stdout
|
||||
stderr_logfile_maxbytes=0
|
||||
|
||||
[program:adbd]
|
||||
command = adb -a -P 5037 server nodaemon
|
||||
autorestart = true
|
Loading…
Reference in New Issue