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

Simplify docker image building process #954

Merged
merged 2 commits into from
Aug 18, 2024
Merged

Simplify docker image building process #954

merged 2 commits into from
Aug 18, 2024

Conversation

mars-lan
Copy link
Contributor

@mars-lan mars-lan commented Aug 18, 2024

🤔 Why?

#919 improved the docker image rebuild speed but also introduced the requirement of manually generating requirement.txt.

🤓 What?

Use multi-stage builds to automatically generate requirements.txt file as part of docker build. Also updated doc & CD workflow accordingly

🧪 Tested?

 % docker build --platform linux/amd64 -t metaphordata/connectors .
  
[+] Building 17.0s (19/19) FINISHED                                                                           docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                          0.0s
 => => transferring dockerfile: 669B                                                                                          0.0s
 => [internal] load metadata for docker.io/library/python:3.8-slim                                                            0.9s
 => [auth] library/python:pull token for registry-1.docker.io                                                                 0.0s
 => [internal] load .dockerignore                                                                                             0.0s
 => => transferring context: 158B                                                                                             0.0s
 => [base 1/1] FROM docker.io/library/python:3.8-slim@sha256:f8b4609a66cdaa133fa57e2ca8e2f03de2ebb44ffefb4c0b8b2de782aefca4a  0.0s
 => [internal] load build context                                                                                             1.1s
 => => transferring context: 1.92MB                                                                                           1.1s
 => CACHED [builder 1/4] RUN pip install poetry                                                                               0.0s
 => [builder 2/4] COPY pyproject.toml poetry.lock src/                                                                        0.0s
 => [builder 3/4] WORKDIR /src                                                                                                0.0s
 => [builder 4/4] RUN poetry export     --without dev     --all-extras     --format=requirements.txt     --output=requiremen  1.9s
 => CACHED [runtime 1/8] RUN apt-get clean                                                                                    0.0s 
 => CACHED [runtime 2/8] RUN apt-get update                                                                                   0.0s 
 => CACHED [runtime 3/8] RUN apt-get install -y git build-essential libsasl2-dev                                              0.0s 
 => CACHED [runtime 4/8] COPY --from=builder /src/requirements.txt /dep/requirements.txt                                      0.0s 
 => CACHED [runtime 5/8] RUN pip install -r /dep/requirements.txt --no-deps                                                   0.0s
 => [runtime 6/8] COPY . src/                                                                                                 2.0s
 => [runtime 7/8] RUN pip install '/src[all]'                                                                                 9.9s
 => [runtime 8/8] RUN rm -rf /src                                                                                             0.4s 
 => exporting to image                                                                                                        0.4s 
 => => exporting layers                                                                                                       0.4s 
 => => writing image sha256:516c802c21af76dcb522ce57537f12f8c159669c35234b5e45badf72776b9d8b                                  0.0s 
 => => naming to docker.io/metaphordata/connectors                                                                            0.0s 

☑️ Checks

  • My PR contains actual code changes, and I have updated the version number in pyproject.toml.

@mars-lan mars-lan marked this pull request as ready for review August 18, 2024 13:35
Copy link

github-actions bot commented Aug 18, 2024

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
11788 10473 89% 85% 🟢

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: ccdcd70 by action🐍

Copy link

codecov bot commented Aug 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.84%. Comparing base (46fca04) to head (ccdcd70).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #954   +/-   ##
=======================================
  Coverage   88.84%   88.84%           
=======================================
  Files         182      182           
  Lines       11788    11788           
=======================================
  Hits        10473    10473           
  Misses       1315     1315           

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

@mars-lan mars-lan enabled auto-merge (squash) August 18, 2024 16:25
Copy link
Contributor

@alyiwang alyiwang left a comment

Choose a reason for hiding this comment

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

LGTM

@mars-lan mars-lan merged commit e4d25b4 into main Aug 18, 2024
6 checks passed
@mars-lan mars-lan deleted the docker branch August 18, 2024 22:08
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