-
Notifications
You must be signed in to change notification settings - Fork 0
Fix Docker setup #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix Docker setup #98
Changes from all commits
db8adcb
d38d970
e2c8f6e
c55ab04
79f1da9
1097944
f274c77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| .git | ||
| .circleci | ||
| .github | ||
| .DS_Store | ||
| coverage | ||
| log/* | ||
| tmp/* | ||
| !log/.keep | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| # syntax=docker/dockerfile:1 | ||
| FROM ruby:4.0.4 | ||
|
|
||
| RUN dpkg --add-architecture i386 \ | ||
|
|
@@ -19,24 +20,30 @@ RUN dpkg --add-architecture i386 \ | |
| chromium-driver \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN gem install bundler -v 2.2.21 | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY Gemfile Gemfile.lock ./ | ||
| RUN bundle _2.2.21_ install --jobs=4 --retry=3 | ||
| ENV BUNDLE_GEMFILE=/app/Gemfile \ | ||
| BUNDLE_JOBS=4 \ | ||
| BUNDLE_RETRY=3 | ||
|
|
||
| COPY Gemfile Gemfile.lock .ruby-version ./ | ||
| RUN --mount=type=cache,target=/usr/local/bundle/cache,sharing=locked \ | ||
| bundle install | ||
|
|
||
| # Dual-boot: Gemfile.next targets the Rails version we're upgrading to. | ||
| # 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 |
||
| BUNDLE_GEMFILE=/app/Gemfile.next bundle install | ||
|
|
||
| COPY . . | ||
| COPY --chmod=0755 docker/entrypoint.sh /usr/local/bin/entrypoint.sh | ||
|
|
||
| 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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? |
||
|
|
||
| EXPOSE 3000 | ||
|
|
||
| HEALTHCHECK --interval=10s --timeout=3s --start-period=60s --retries=6 \ | ||
| CMD curl -fsS http://localhost:3000/up || exit 1 | ||
|
|
||
| ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] | ||
| CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need the .ruby-version file here? the version is already defined by the base image