43 lines
1.4 KiB
Docker
43 lines
1.4 KiB
Docker
FROM reactnativecommunity/react-native-android
|
|
|
|
|
|
# config and update
|
|
ENV DEBIAN_FRONTEND noninteractive
|
|
ENV DOCKER=true
|
|
WORKDIR /home
|
|
RUN apt-get update
|
|
RUN mkdir /var/log/app
|
|
ARG SSH_KEY
|
|
ARG NODE_VERSION
|
|
ARG GH_TOKEN
|
|
ARG NPM_TOKEN
|
|
ARG RN_PROJECT_FOLDER_NAME
|
|
|
|
# set up NVM and use v16 LTS
|
|
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
|
|
ENV NVM_DIR /root/.nvm
|
|
RUN . "$NVM_DIR/nvm.sh" && nvm install $NODE_VERSION && nvm alias default $NODE_VERSION && nvm use default
|
|
ENV NODE_PATH $NVM_DIR/versions/node/v$NODE_VERSION/lib/node_modules
|
|
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
|
|
RUN npm install -g react-native-cli
|
|
|
|
# add gh/npm tokens and install project dependencies
|
|
RUN echo \"//github.com/:_authToken=$GH_TOKEN\" > /home/app/.npmrc
|
|
RUN echo \"//registry.npmjs.org/:_authToken=$NPM_TOKEN\" >> /home/app/.npmrc
|
|
RUN cd /home/$RN_PROJECT_FOLDER_NAME && npm install
|
|
|
|
# Install SSH server
|
|
RUN apt-get -y install openssh-server
|
|
COPY sshd_config /etc/ssh/sshd_config
|
|
RUN mkdir /root/.ssh
|
|
RUN touch /root/.ssh/authorized_keys
|
|
RUN chmod 600 /root/.ssh/authorized_keys
|
|
RUN mkdir -p /run/sshd
|
|
|
|
# set up on-launch commands
|
|
RUN apt-get install -y supervisor
|
|
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] |