@@ -94,26 +94,30 @@ ENV RAILS_ENV=${rails_env}
9494# ENV FAVOR_LOCAL_GEMS 1
9595
9696# ### OpenStudio Server Code
97- # 1. Setup workspace
98- WORKDIR /opt/openstudio/server
99-
100- # 2. Add Gemfiles and install Ruby dependencies first (for caching)
97+ # First upload the Gemfile* so that it can cache the Gems -- do this first because it is slow
98+ ADD /bin /opt/openstudio/bin
10199ADD /server/Gemfile /opt/openstudio/server/Gemfile
100+ WORKDIR /opt/openstudio/server
102101RUN bundle _${OS_BUNDLER_VERSION}_ install --jobs=3 --retry=3 ${bundle_args}
103102
104- # 3. NOW ADD THE ENTIRE SERVER CODE
105- # (This ensures rake has everything it needs to precompile)
106- ADD /server /opt/openstudio/server
107- ADD /bin /opt/openstudio/bin
108- ADD .rubocop.yml /opt/openstudio/.rubocop.yml
103+ # Add the app assets and precompile assets. Do it this way so that when the app changes the assets don't
104+ # have to be recompiled everytime
105+ ADD /server/Rakefile /opt/openstudio/server/Rakefile
106+ ADD /server/config/ /opt/openstudio/server/config/
107+ ADD /server/app/assets/ /opt/openstudio/server/app/assets/
109108
110- # 4. Create log directory and Precompile Assets
111- # Added SECRET_KEY_BASE and RAILS_ENV to prevent "Abort" crashes
112- RUN mkdir -p /opt/openstudio/server/log && \
113- SECRET_KEY_BASE=dummy_key_for_build RAILS_ENV=production bundle exec rake assets:precompile --trace
109+ # Now call precompile
110+ RUN mkdir /opt/openstudio/server/log
111+ RUN bundle exec rake assets:precompile --trace
114112
115- # 5. Final bundle check
116- RUN rm -f Gemfile.lock && bundle install --jobs=3 --retry=3
113+ # Bundle app source
114+ ADD /server /opt/openstudio/server
115+ # Add in /spec for testing
116+ # ADD /server/spec /opt/openstudio/server/spec
117+ ADD .rubocop.yml /opt/openstudio/.rubocop.yml
118+ # Run bundle again, because if the user has a local Gemfile.lock it will have been overriden
119+ RUN rm Gemfile.lock
120+ RUN bundle install --jobs=3 --retry=3
117121
118122# Add in scripts for running server. This includes the wait-for-it scripts to ensure other processes (mongo, redis) have
119123# started before starting the main process.
0 commit comments