Skip to content
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

Renovate/multi stage docker #466

Closed

Conversation

crosspolar
Copy link
Contributor

Changed the Dockerfile to a multi-stage docker in order to reduce image size from 1.54GB to roughly 471 MB and eliminate Docker vulnerability errors.

Structure of the image is that .venv lies in root and the app in app. This made it easier for Pycharm to detect the venv-executable when Debugging and poetry run is not necessary anymore.

I'm not sure if all packages are installed in the final build (maybe SSL is missing?).

@crosspolar
Copy link
Contributor Author

Also related to #424

Copy link
Contributor

@Theophile-Madet Theophile-Madet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more great suggestion! Thank you!

It's not quite ready because we can't run the tests without the dev modules installed by poetry. I tried with them installed but I got errors :

FAILED tapir/coop/tests/test_send_membership_confirmation_email.py::TestSendMembershipConfirmationEmail::test_sends_correct_mail_to_investing_member - AttributeError: function/symbol 'pango_context_set_round_glyph_positions' not found in library 'libpango-1.0.so.0': /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined symbol: pango_context_set_round_glyph_positions

Could you look into them?

Dockerfile Show resolved Hide resolved
README.md Show resolved Hide resolved
docker-compose.yml Outdated Show resolved Hide resolved
@@ -16,9 +16,7 @@ services:

web:
build: .
command: bash -c "poetry install &&
poetry run python manage.py compilemessages --ignore \".venv\" &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CONTRIBUTING.md suggests restarting the container so that compilemessages runs, if we don't run compilemessages on start we should update the doc.

@crosspolar
Copy link
Contributor Author

crosspolar commented Dec 29, 2023

One more great suggestion! Thank you!

It's not quite ready because we can't run the tests without the dev modules installed by poetry. I tried with them installed but I got errors :

FAILED tapir/coop/tests/test_send_membership_confirmation_email.py::TestSendMembershipConfirmationEmail::test_sends_correct_mail_to_investing_member - AttributeError: function/symbol 'pango_context_set_round_glyph_positions' not found in library 'libpango-1.0.so.0': /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined symbol: pango_context_set_round_glyph_positions

Could you look into them?

Thanks for having a good look!

We could create an extra stage with dev-dependencies and build it for testing only, e.g.

  web:
    build:
      context: .
      target: testing

Would that be possible with Github actions to override target with runtime or similar?

@Theophile-Madet
Copy link
Contributor

Theophile-Madet commented Dec 29, 2023

Would that be possible with Github actions to override target with runtime or similar?

Since both GitHub actions and local development use the same docker-compose.yml file, but production uses a separate one, as long as we specify in the docker-compose file that is in this repo that we want the test stuff installed too, we should be fine?

@crosspolar
Copy link
Contributor Author

I'll close it and retry later

@crosspolar crosspolar closed this Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants