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

build(dockerfile): enhanced production dockerfile #1151

Merged
merged 3 commits into from
Sep 30, 2023

Conversation

iknowright
Copy link
Contributor

Types of changes

  • Bugfix
  • New feature
  • Refactoring Dockerfile
  • Breaking change (any change that would cause existing functionality to not work as expected)
  • Documentation Update
  • Other (please describe)

Description

Use multi-stage feature on Docker to enable easy-read and better maintenance for Dockerfile

Two stages: node_stage and python_stage
node_stage:

  • handling node_modules and node executable, by using multi-stage with FROM, we can specify docker image taf and get the node run-time with no extra works (nvm and hardcoded download link)
  • use buster-slim variant

python_stage:

  • handling Python environment and web server instructions
  • using slim-buster variant
  • need to manually install libpq and GCC for pyscopg2 and uwsgi as we downsize from buster to slim-buster

Notes:

  • need to align image variant to {size-variant}-{debian-variant} to make node executable executable (For example, both node_stage and python_stage needs to be SLIM BUSTER)

Steps to Test This Pull Request

  • Same

Expected behavior

Size reduced up to 50% and more

from the staging environment, test results are as follow:
pycontw-2023_web-enhanced-dockerfile latest e620e4f466ac 24 seconds ago 626MB
pycontw-2023_web latest 11ff9f780b7d 2 weeks ago 1.56GB

closes #1139

@iknowright iknowright self-assigned this Sep 16, 2023
@codecov-commenter
Copy link

codecov-commenter commented Sep 16, 2023

Codecov Report

Patch coverage: 66.66% and project coverage change: +0.47% 🎉

Comparison is base (74b334a) 69.74% compared to head (eb9bdd1) 70.21%.
Report is 8 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1151      +/-   ##
==========================================
+ Coverage   69.74%   70.21%   +0.47%     
==========================================
  Files          85       85              
  Lines        3378     3381       +3     
==========================================
+ Hits         2356     2374      +18     
+ Misses       1022     1007      -15     
Files Changed Coverage Δ
src/ccip/views.py 33.98% <50.00%> (+0.31%) ⬆️
src/sponsors/translation.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@josix josix left a comment

Choose a reason for hiding this comment

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

Thanks @iknowright for making this change, I think we also need to apply these changes todev.Dockerfile. Could you help me update that?

@iknowright
Copy link
Contributor Author

Thanks @iknowright for making this change, I think we also need to apply these changes todev.Dockerfile. Could you help me update that?

Updated.

Copy link
Collaborator

@josix josix left a comment

Choose a reason for hiding this comment

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

LGTM thanks!

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.

[Feature Request] Improve production Dockerfile
3 participants