Fix Docker setup - #98
Open
mateusdeap wants to merge 7 commits into
Open
Conversation
This just ensures BuildKit uses the latest version of Dockerfile syntax
This lets us drop the options in the command and also guarantees these options are set when running bundler commands inside the container. Using an absolute path for BUNDLE_GEMFILE also guarantees bundler commands work properly in subdirectories inside the container
This prevents cache busting the entrypoint copy on changes to the application code.
service_started doesn't prevent race conditions since the web service may have started and db operations might still be working. Rails provides an `/up` endpoint which guarantees the _app_ is up. Only after that is it safe to run the entrypoint script
Attempting to reuse the web image presumes it already exists locally. Furthermore, it's better to have them build separately since their dependencies can be different
arielj
requested changes
Jul 29, 2026
| # Remove this block (and Gemfile.next / Gemfile.next.lock) once the upgrade lands. | ||
| COPY Gemfile.next Gemfile.next.lock ./ | ||
| RUN BUNDLE_GEMFILE=Gemfile.next bundle _2.2.21_ install --jobs=4 --retry=3 | ||
| RUN --mount=type=cache,target=/usr/local/bundle/cache,sharing=locked \ |
Contributor
There was a problem hiding this comment.
this Dockerfile is installing both current and next gems but we don't share the image between the web and web-next services
we can instead use a build ARG and only install the gems for that service to speed this up, check the "Dual-Boot Rails" section in this blogpost https://www.fastruby.io/blog/dual-boot-and-docker.html
|
|
||
| COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh | ||
| RUN chmod +x /usr/local/bin/entrypoint.sh | ||
| COPY . . |
Contributor
There was a problem hiding this comment.
I think we can skip copying all the code inside the container since we are using a mounted volume anyway that replaces that with the actual code?
| BUNDLE_JOBS=4 \ | ||
| BUNDLE_RETRY=3 | ||
|
|
||
| COPY Gemfile Gemfile.lock .ruby-version ./ |
Contributor
There was a problem hiding this comment.
do we need the .ruby-version file here? the version is already defined by the base image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this PR:
Description:
This updates the docker setup for the audit app. Changes docker-compose.yml to build web_next and adds several improvements that help avoid issues with changing dependencies, undesired cache busting when changing application code and also implements caching when running
bundle installThe changes that are actually needed are only the ones configuring web_next to get built from the Dockerfile and removing the version pinning on the
bundle installcommand. The rest is just improvements that I'm suggesting hereHow has this been tested?
What manual tests have been run?
Delete all your local images of for the audit app and attempt to setup the app as in the README.
The rest are standard docker features that require no testing, as long as images build successfully and
docker compose upspins up both containers without issues.