Stop bundle/npm installing as root

Running NPM install as root was causing the pre-install hook to fail due
to the privilege drop. Additionally, the script wasn't actually in place
anyway compounding the sadness. Now we're switching to the docker user
for installing dependencies and copying the scripts directory into the
image first.

Change-Id: Ieaf38d9cd9947e7f809796e38340e10033ae1eb7
Reviewed-on: https://gerrit.instructure.com/101437
Tested-by: Jenkins
Product-Review: Caleb Guanzon <cguanzon@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Brad Horrocks <bhorrocks@instructure.com>
This commit is contained in:
Tyler Pickett 2017-02-08 13:03:13 -07:00
parent 244ba256be
commit 6d6ba7a753
1 changed files with 9 additions and 1 deletions

View File

@ -31,14 +31,22 @@ RUN if [ -e /var/lib/gems/$RUBY_MAJOR.0/gems/bundler-* ]; then BUNDLER_INSTALL="
&& find $GEM_HOME ! -user docker | xargs chown docker:docker
WORKDIR $APP_HOME
USER root
COPY Gemfile ${APP_HOME}
COPY Gemfile.d ${APP_HOME}Gemfile.d
COPY config ${APP_HOME}config
COPY gems ${APP_HOME}gems
RUN bundle install --jobs 8
COPY script ${APP_HOME}script
COPY package.json ${APP_HOME}
RUN chown -R docker:docker ${APP_HOME} /home/docker
# Install deps as docker to avoid sadness w/ npm lifecycle hooks
USER docker
RUN bundle install --jobs 8
RUN npm install
USER root
COPY . $APP_HOME
RUN mkdir -p log \
tmp \