├── Dockerfile ├── LICENSE ├── README.md ├── circle.yml └── entrypoint.sh /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8 2 | 3 | MAINTAINER Entria 4 | 5 | RUN mkdir -p /opt/app 6 | WORKDIR /opt/app 7 | 8 | ENV DEBIAN_FRONTEND noninteractive 9 | 10 | # Install general dependencies 11 | RUN dpkg --add-architecture i386 && apt-get update && apt-get install -yq \ 12 | apt-transport-https \ 13 | autoconf \ 14 | automake \ 15 | build-essential \ 16 | imagemagick \ 17 | jq \ 18 | libc6:i386 \ 19 | libcurl3 \ 20 | libcurl3-gnutls \ 21 | libcurl4-openssl-dev \ 22 | libncurses5:i386 \ 23 | librsvg2-bin \ 24 | libssl-dev \ 25 | libstdc++6:i386 \ 26 | pkg-config \ 27 | python \ 28 | python-dev \ 29 | python-pip \ 30 | python-setuptools \ 31 | software-properties-common \ 32 | zlib1g:i386 \ 33 | zlib1g-dev \ 34 | --no-install-recommends 35 | 36 | # Install AWS CLI 37 | RUN pip install --upgrade awscli 38 | 39 | ENV RUBY_VERSION="2.4.4" 40 | ENV ANDROID_HOME="/opt/android-sdk-linux" 41 | ENV ANDROID_SDK="${ANDROID_HOME}" 42 | ENV PATH="${ANDROID_SDK}/tools:${ANDROID_SDK}/platform-tools:${ANDROID_SDK}/tools/bin:${PATH}" 43 | RUN echo "export PATH=${PATH}" > /root/.profile 44 | 45 | # Install Android SDK (based on: https://github.com/gfx/docker-android-project/blob/master/Dockerfile) 46 | # See for CircleCI Issue: 47 | # https://discuss.circleci.com/t/failed-to-register-layer-error-processing-tar-file-exit-status-1-container-id-249512-cannot-be-mapped-to-a-host-id/13453/5 48 | # Grab URL from footer of https://developer.android.com/studio/index.html 49 | # Following URL is for 26.0.2 50 | ENV ANDROID_SDK_URL https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip 51 | 52 | #ENV ANDROID_BUILD_TOOLS_VERSION 26.0.2,25.0.3 53 | #ENV ANDROID_API_LEVELS android-26,android-25 54 | #ENV ANDROID_COMPONENTS platform-tools,build-tools-${ANDROID_BUILD_TOOLS_VERSION},${ANDROID_API_LEVELS} 55 | #ENV GOOGLE_COMPONENTS extra-android-m2repository,extra-google-m2repository,extra-google-google_play_services,extra-google-gcm 56 | 57 | RUN curl -L "${ANDROID_SDK_URL}" -o /tmp/android-sdk-linux.zip && \ 58 | unzip /tmp/android-sdk-linux.zip -d /opt/ && \ 59 | chown -R root:root /opt && \ 60 | rm /tmp/android-sdk-linux.zip && \ 61 | mkdir ${ANDROID_HOME} && \ 62 | mv /opt/tools ${ANDROID_HOME}/ && \ 63 | ls ${ANDROID_HOME} && \ 64 | ls ${ANDROID_HOME}/tools && chown -R root:root ${ANDROID_HOME} 65 | 66 | # Install Android SDK components 67 | RUN echo y | sdkmanager "platform-tools" "build-tools;26.0.2" "build-tools;25.0.3" "platforms;android-26" "platforms;android-25" \ 68 | "extras;google;m2repository" "extras;android;m2repository" "extras;google;google_play_services" 69 | 70 | RUN echo y | sdkmanager --licenses 71 | # Install Watchman 72 | RUN git clone https://github.com/facebook/watchman.git && \ 73 | cd watchman && \ 74 | git checkout v4.7.0 && \ 75 | ./autogen.sh && ./configure && make && make install && cd .. && rm -rf watchman 76 | 77 | # Install Ruby and RubyGems 78 | RUN wget http://ftp.ruby-lang.org/pub/ruby/ruby-${RUBY_VERSION}.tar.gz && \ 79 | tar -xzf ruby-${RUBY_VERSION}.tar.gz && \ 80 | rm ruby-${RUBY_VERSION}.tar.gz && \ 81 | cd ruby-${RUBY_VERSION}/ && \ 82 | ./configure --disable-install-rdoc && make && make install 83 | 84 | # Install bundler 85 | RUN gem install bundler 86 | 87 | # Install Slack CLI https://github.com/rockymadden/slack-cli 88 | RUN curl -O https://raw.githubusercontent.com/rockymadden/slack-cli/master/src/slack && \ 89 | chmod +x slack && \ 90 | ln -s /opt/app/slack /usr/local/bin/slack 91 | 92 | # Install Node JS and Yarn 93 | # https://github.com/nodejs/docker-node/blob/12ba2e5432cd50037b6c0cf53464b5063b028227/8.1/Dockerfile 94 | ENV NPM_CONFIG_LOGLEVEL info 95 | ENV NODE_VERSION 12.13.1 96 | ENV YARN_VERSION 1.19.1 97 | 98 | RUN groupadd --gid 1000 node && \ 99 | useradd --uid 1000 --gid node --shell /bin/bash --create-home node 100 | 101 | # gpg keys listed at https://github.com/nodejs/node#release-keys 102 | RUN set -ex \ 103 | && for key in \ 104 | 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ 105 | B9AE9905FFD7803F25714661B63B535A4C206CA9 \ 106 | 77984A986EBC2AA786BC0F66B01FBB92821C587A \ 107 | 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ 108 | FD3A5288F042B6850C66B31F09FE44734EB7990E \ 109 | 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \ 110 | C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ 111 | DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ 112 | ; do \ 113 | gpg --no-tty --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \ 114 | gpg --no-tty --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \ 115 | gpg --no-tty --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \ 116 | done 117 | 118 | RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \ 119 | && case "${dpkgArch##*-}" in \ 120 | amd64) ARCH='x64';; \ 121 | ppc64el) ARCH='ppc64le';; \ 122 | s390x) ARCH='s390x';; \ 123 | arm64) ARCH='arm64';; \ 124 | armhf) ARCH='armv7l';; \ 125 | i386) ARCH='x86';; \ 126 | *) echo "unsupported architecture"; exit 1 ;; \ 127 | esac \ 128 | && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \ 129 | && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ 130 | && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ 131 | && grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ 132 | && tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \ 133 | && rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \ 134 | && ln -s /usr/local/bin/node /usr/local/bin/nodejs 135 | 136 | RUN set -ex \ 137 | && for key in \ 138 | 6A010C5166006599AA17F08146C2130DFD2497F5 \ 139 | ; do \ 140 | gpg --no-tty --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \ 141 | gpg --no-tty --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \ 142 | gpg --no-tty --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \ 143 | done \ 144 | && curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \ 145 | && curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \ 146 | && gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ 147 | && mkdir -p /opt \ 148 | && tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/ \ 149 | && ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \ 150 | && ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \ 151 | && rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz 152 | 153 | # Clean 154 | RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ 155 | apt-get autoremove -y && \ 156 | apt-get clean 157 | 158 | # Support Gradle 159 | ENV TERM dumb 160 | 161 | # Install code-push-cli 162 | RUN npm install -g code-push-cli && chown -R root:root /usr/local/lib/node_modules/code-push-cli/node_modules 163 | 164 | COPY entrypoint.sh /entrypoint.sh 165 | 166 | ENTRYPOINT ["/entrypoint.sh"] 167 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Entria 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Docker React Native Android 2 | ![circle-ci](https://circleci.com/gh/entria/docker-react-native-android.svg?style=shield&circle-token=7198dca0106a9a945edeaf47162b64d628c49f5d) 3 | 4 | Docker image for building React Native apps for Android. 5 | -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | executorType: docker 3 | jobs: 4 | build: 5 | environment: 6 | - IMAGE_NAME: "entria/react-native-android" 7 | working_directory: ~/app 8 | docker: 9 | - image: buildpack-deps:trusty 10 | steps: 11 | - checkout 12 | - run: 13 | name: Install Docker client 14 | command: | 15 | set -x 16 | VER="17.05.0-ce" 17 | curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz 18 | tar -xz -C /tmp -f /tmp/docker-$VER.tgz 19 | mv /tmp/docker/* /usr/bin 20 | - setup_remote_docker 21 | - run: 22 | name: Build Docker image 23 | command: | 24 | docker build -t $IMAGE_NAME:latest . 25 | - run: 26 | name: Push Docker image 27 | command: | 28 | if [ "${CIRCLE_BRANCH}" == "master" ]; then 29 | TAG="0.1.${CIRCLE_BUILD_NUM}" 30 | docker login -u $DOCKERHUB_LOGIN -p $DOCKERHUB_PASS 31 | docker tag $IMAGE_NAME:latest $IMAGE_NAME:$TAG 32 | docker push $IMAGE_NAME:latest 33 | docker push $IMAGE_NAME:$TAG 34 | fi 35 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_watches 3 | #echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_queued_events 4 | #echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_instances 5 | #watchman shutdown-server 6 | #sudo sysctl -p 7 | echo fs.inotify.max_user_instances=999999 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p 8 | echo fs.inotify.max_user_watches=999999 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p 9 | echo fs.inotify.max_queued_events=999999 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p 10 | /bin/bash 11 | --------------------------------------------------------------------------------