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

Add support to choose docker build target architecture #1350

Merged

Conversation

andresgomezfrr
Copy link
Contributor

TL;DR

Add new TARGET_PLATFORM_BUILD ENV var to set the target platform architecture to allow to build docker image on a machine with a different architecture than the docker image will be executed.

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Complete description

NA

Tracking Issue

flyteorg/flyte#3097

Follow-up issue

NA

@welcome
Copy link

welcome bot commented Nov 23, 2022

Thank you for opening this pull request! 🙌

These tips will help get your PR across the finish line:

  • Most of the repos have a PR template; if not, fill it out to the best of your knowledge.
  • Sign off your commits (Reference: DCO Guide).

@codecov
Copy link

codecov bot commented Nov 28, 2022

Codecov Report

Merging #1350 (1c1721c) into master (430795d) will increase coverage by 0.10%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #1350      +/-   ##
==========================================
+ Coverage   68.94%   69.04%   +0.10%     
==========================================
  Files         291      291              
  Lines       26656    26699      +43     
  Branches     2508     2514       +6     
==========================================
+ Hits        18377    18435      +58     
+ Misses       7789     7772      -17     
- Partials      490      492       +2     
Impacted Files Coverage Δ
tests/flytekit/unit/core/test_promise.py 89.18% <0.00%> (-0.10%) ⬇️
flytekit/core/type_engine.py 58.77% <0.00%> (ø)
tests/flytekit/unit/core/test_type_hints.py 96.24% <0.00%> (+<0.01%) ⬆️
tests/flytekit/unit/cli/pyflyte/test_run.py 99.20% <0.00%> (+0.03%) ⬆️
flytekit/core/promise.py 52.70% <0.00%> (+0.74%) ⬆️
flytekit/types/schema/types.py 38.30% <0.00%> (+0.75%) ⬆️
flytekit/core/data_persistence.py 35.52% <0.00%> (+1.72%) ⬆️
flytekit/clis/sdk_in_container/run.py 84.15% <0.00%> (+4.29%) ⬆️
tests/flytekit/unit/cli/pyflyte/workflow.py 100.00% <0.00%> (+13.04%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

honnix
honnix previously approved these changes Nov 29, 2022
Copy link
Member

@honnix honnix left a comment

Choose a reason for hiding this comment

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

I assume you tested the change.

@honnix
Copy link
Member

honnix commented Nov 29, 2022

Please fix DCO by following https://github.com/flyteorg/flytekit/pull/1350/checks?check_run_id=9764766999

honnix
honnix previously approved these changes Nov 29, 2022
Copy link
Member

@pingsutw pingsutw left a comment

Choose a reason for hiding this comment

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

nit: There is a lint error, could you fix it?


# This build command is the raison d'etre of this script, it ensures that the version is injected into the image itself
docker build . --build-arg tag="$FLYTE_INTERNAL_IMAGE" -t "$FLYTE_INTERNAL_IMAGE" -f "${DOCKERFILE_PATH}"
eval "$(docker build ${DOCKER_PLATFORM_OPT} . --build-arg tag=${FLYTE_INTERNAL_IMAGE} -t ${FLYTE_INTERNAL_IMAGE} -f ${DOCKERFILE_PATH})"
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this change. Would the following not work?

docker build ${DOCKER_PLATFORM_OPT} . --build-arg tag=${FLYTE_INTERNAL_IMAGE} -t ${FLYTE_INTERNAL_IMAGE} -f ${DOCKERFILE_PATH}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's check if the linter passes with that. The previous change was based on the linter's suggestion.

andresgomezfrr and others added 4 commits November 30, 2022 17:57
Signed-off-by: Andres Gomez Ferrer <andresg@spotify.com>
Signed-off-by: Andres Gomez Ferrer <andresg@spotify.com>
Signed-off-by: Andres Gomez Ferrer <andresg@spotify.com>
Co-authored-by: Honnix <honnix@users.noreply.github.com>
Signed-off-by: Andres Gomez Ferrer <andresg@spotify.com>
Signed-off-by: Hongxin Liang <honnix@users.noreply.github.com>
@honnix honnix force-pushed the add-platform-flytekit-script branch from 86232c7 to bd96c45 Compare November 30, 2022 21:51
@honnix
Copy link
Member

honnix commented Nov 30, 2022

Hopefully bd96c45 could fix the shellcheck issue.

Signed-off-by: Hongxin Liang <honnix@users.noreply.github.com>
@wild-endeavor wild-endeavor merged commit 7994f47 into flyteorg:master Dec 1, 2022
@welcome
Copy link

welcome bot commented Dec 1, 2022

Congrats on merging your first pull request! 🎉

@andresgomezfrr andresgomezfrr deleted the add-platform-flytekit-script branch December 1, 2022 18:46
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.

4 participants