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:
parent
244ba256be
commit
6d6ba7a753
10
Dockerfile
10
Dockerfile
|
@ -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 \
|
||||
|
|
Loading…
Reference in New Issue