update readme, add dockman script, require env vars when building, move npm install to image build process

This commit is contained in:
2023-07-28 18:17:12 -04:00
parent cf9b13efdf
commit fc602f01d7
9 changed files with 317 additions and 163 deletions

View File

@@ -3,20 +3,29 @@ 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
ENV NODE_VERSION 16.20.1
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
@@ -31,4 +40,4 @@ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]