Skip to content
This repository was archived by the owner on Mar 19, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Finally think I fixed the docker dev on rebuild/restart when gem vers…
…ions change.

See: https://nickjanetakis.com/blog/dealing-with-lock-files-when-using-ruby-node-and-elixir-with-docker
for an EXACT description of the problem. Now with this change and the checked in Gemfile.lock,
it should be easy to see when a change happens on a rebuild and check that into src
ctrl (plus, it should just work).

TESTING:
- rebuilt the container and verified I can login.
  • Loading branch information
sadleb committed Oct 21, 2019
commit 4dc089e5fddcf8c0617158e1b543e76e91f1b2bd
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ WORKDIR /app
COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock
COPY rubycas-server.gemspec /app/rubycas-server.gemspec
RUN bundle install

# See this article for why we copy to /tmp
# We have a runtime script to check this so we can deal
# with changes properly when gem versions get updated.
# https://nickjanetakis.com/blog/dealing-with-lock-files-when-using-ruby-node-and-elixir-with-docker
RUN bundle install && cp Gemfile.lock /tmp

# Do this after bundle install b/c if we do it before then changing any files
# causes bundle install to be invalidated and run again on the next build
Expand Down
22 changes: 22 additions & 0 deletions docker-compose/scripts/docker_compose_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,26 @@
# into the actual application config.yml file. Note: envsubst needs gettext to be installed.
envsubst < /app/docker-compose/config/config.yml > /app/config/config.yml

# Take from here: https://nickjanetakis.com/blog/dealing-with-lock-files-when-using-ruby-node-and-elixir-with-docker
# To deal with problems when the Gemfile.lock changes in between runs of
# bundle install
set -e

built_lock_file="/tmp/Gemfile.lock"
current_lock_file="Gemfile.lock"

function cp_built_lock_file() {
cp "${built_lock_file}" "${current_lock_file}"
}

if [ -f "${current_lock_file}" ]; then
diff="$(diff "${built_lock_file}" "${current_lock_file}")"
if [ "${diff}" != "" 2>/dev/null ]; then
cp_built_lock_file
fi
else
cp_built_lock_file
fi


bundle exec rubycas-server -p 3002 -c /app/config/config.yml