buncha fixes to make sure env vars are set properly before creating the image, and move npm install to dockerfile to bake it in the image
This commit is contained in:
13
Dockerfile
13
Dockerfile
@@ -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.13.0
|
||||
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"]
|
Reference in New Issue
Block a user