-
-
Notifications
You must be signed in to change notification settings - Fork 724
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
Use Alpine Image for Docker #12905
base: master
Are you sure you want to change the base?
Use Alpine Image for Docker #12905
Conversation
@macanudo527 there is a failed spec |
The last error is a bit strange. It is saving the Spree::Variant Create (1.0ms) INSERT INTO "spree_variants" ("weight", "product_id", "cost_currency", "unit_value", "display_as",
"variant_unit", "unit_presentation", "created_at", "updated_at", "shipping_category_id", "primary_taxon_id", "supplier_id") VALUES
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12) RETURNING "id" [["weight", "0.0"], ["product_id", 12], ["cost_currency", "AUD"],
["unit_value", 0.5001], ["display_as", ""], ["variant_unit", "volume"], ["unit_presentation", "500.09mL"], ["created_at", "2024-10-15
23:48:04.298869"], ["updated_at", "2024-10-15 23:48:04.298869"], ["shipping_category_id", 1], ["primary_taxon_id", 5],
["supplier_id", 3]]
08:48:04 rails.1 | ↳ app/models/spree/product.rb:261:in `ensure_standard_variant' |
@macanudo527 the last Product Refactor PR has been merged , you'll probably need to rebase your branch |
aa041d5
to
3640057
Compare
f629c0d
to
3e0be85
Compare
@sigmundpetersen Did you make an accidental update? |
Hi @macanudo527 I just rebased your branch. |
OK, that's kind of strange the compare looked like it was strangely incomplete, but maybe the tests are just flakey. Thanks! |
Rebuild was green so I'm moving this to Code Review again 👍 |
4209818
to
1b3ebcb
Compare
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.
Nice work!
I'm not quite sure on the way forward though.
ba3fe27
to
7b03d15
Compare
0772ad7
to
f8e0c7f
Compare
@mkllnk I revised it so that you can optionally build it with the Alpine image by adding it to the build script. |
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.
Looks gone now ! But I think we should wait for #12950 before merging this has there are still some BigDecimal related changes in this PR.
If you are keen to play with Docker, it would be nice to dockerise OFN, ie have a separate Image for the OFN code, and each dependency (Postgres, Redis etc...) It would be a good start to moving toward a Docker based deployment, especially now that Kamal exists
7752cf6
to
9fb90d9
Compare
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.
I took a look so I could keep up to date with what's happening. I have a few queries.
Testing on MacI just tried building the default Ubuntu, and it failed after filling up my hard drive 😞 . So after some cleanup and a system restart I tried the Alpine image. I now have more disk space (?! maybe because docker cleaned up the failed ubuntu image?). But it failed:
Maybe that's because #12950 hasn't been merged yet. I've marked as blocked and set to 'In Progress' until that's merged, then we can rebase and try again. |
This is the exact reason. We need to wait for that PR to pass and then I can rebase this with it and the error should go away. |
This reverts commit 2d193a6.
9fb90d9
to
e5648dd
Compare
838b3a4
to
927df70
Compare
927df70
to
eb334d0
Compare
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.
Thanks for following up!
What? Why?
This replaces the Ubuntu image with a more lightweight image optimized for Ruby, which reduces the size of the images on the computer and simplifies the build. It also eliminates the need to prepend commands with
bundle exec
and the need for any version manager in the image.I also added
OFN_REDIS_TEST_URL
so that tests usingSpreePreferences
now pass.Some disadvantages:
When the ruby version is upgraded, the image will need to be updated and rebuilt.
Since Open Food Network uses specific versions of default gems that might not match the Alpine image's default gems, adjustments will need to be made. Currently, OFN's
BigDecimal
needed to be upgraded to 3.1.1 and the Alpine image'srake
andbundler
needed to be upgraded to match OFN's.What should we test?
Build and spin up the docker container:
Verify that there are no fatal errors.
Visit HTTP://localhost:3000/
This has been tested under Ubuntu, Windows w/WSL, and Windows, but not on Mac
Release notes
Changelog Category (reviewers may add a label for the release notes):
The title of the pull request will be included in the release notes.
Dependencies
Documentation updates