Skip to content

chore: Add GitHub workflow to publish Docker image - #847

Merged
andygrove merged 16 commits into
apache:mainfrom
andygrove:docker-publish
Aug 19, 2024
Merged

andygrove merged 16 commits into
apache:mainfrom
andygrove:docker-publish

Conversation

@andygrove

@andygrove andygrove commented Aug 19, 2024

Copy link
Copy Markdown
Member

Which issue does this PR close?

Part of #721

Rationale for this change

Make it easier for users to use Comet

What changes are included in this PR?

  • New GitHub workflow
  • Modified Dockerfile to build from local repo contents instead of cloning Comet

How are these changes tested?

I tested building the Docker image locally.

I don't think I can test the workflow until this PR is merged 😞

@andygrove
andygrove requested a review from comphead August 19, 2024 16:23
Comment thread .github/workflows/docker-publish.yml Outdated
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this just for the build environment or does this get included in the image? Why not OpenJDK?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is just for the build environment so that we can use Maven to get the Comet version number.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I removed this line - this was copied from an example

@andygrove
andygrove marked this pull request as draft August 19, 2024 16:41
@andygrove
andygrove marked this pull request as ready for review August 19, 2024 17:18
@andygrove andygrove mentioned this pull request Aug 19, 2024
5 tasks
Comment thread kube/Dockerfile Outdated
Comment thread .github/workflows/docker-publish.yml Outdated
run: echo "The current Maven version is ${{ env.COMET_VERSION }}"
- name: Build and push Docker image
run: |
docker build -t datafusion-comet:spark-3.4-scala-2.12-${{ env.COMET_VERSION }} -f kube/Dockerfile .

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

are we planning to parametrize spark and scala versions later? the same like its done for comet version

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

good point, I will update that

@edmondop edmondop Aug 19, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think also it might be important here to use docker buildx to create images that are compatible with arm if comet supports it, see https://docs.docker.com/build/ci/github-actions/multi-platform/

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks @edmondop I have made this change

@comphead comphead left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it looks good to me. thanks @andygrove

Co-authored-by: Oleks V <comphead@users.noreply.github.com>
Comment thread .github/workflows/docker-publish.yml Outdated
docker push ghcr.io/apache/datafusion-comet:$DOCKER_TAG
env:
DOCKER_USER: ${{ github.actor }}
DOCKER_PASS: ${{ secrets.GITHUB_TOKEN }} No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missing newline here

Comment thread .github/workflows/docker-publish.yml Outdated
Comment thread kube/Dockerfile
COPY --from=builder /opt/datafusion-comet/spark/target/comet-spark-spark${SPARK_VERSION}_$SCALA_VERSION-0.1.0-SNAPSHOT.jar $SPARK_HOME/jars No newline at end of file

# ntoe the use of a wildcard in the file name so that this works with both snapshot and final release versions
COPY --from=builder /comet/spark/target/comet-spark-spark${SPARK_VERSION}_$SCALA_VERSION-0.2.0*.jar $SPARK_HOME/jars No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Newline at EOF

Comment thread .github/workflows/docker-publish.yml Outdated
run: echo "The current Maven version is ${{ env.COMET_VERSION }}"
- name: Build and push Docker image
run: |
docker build -t datafusion-comet:spark-3.4-scala-2.12-${{ env.COMET_VERSION }} -f kube/Dockerfile .

@edmondop edmondop Aug 19, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think also it might be important here to use docker buildx to create images that are compatible with arm if comet supports it, see https://docs.docker.com/build/ci/github-actions/multi-platform/

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 34.19%. Comparing base (c9af3f4) to head (3cddf4b).
Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #847      +/-   ##
============================================
+ Coverage     34.05%   34.19%   +0.14%     
- Complexity      879      885       +6     
============================================
  Files           112      112              
  Lines         42959    42950       -9     
  Branches       9488     9486       -2     
============================================
+ Hits          14629    14688      +59     
+ Misses        25330    25268      -62     
+ Partials       3000     2994       -6     

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

@edmondop edmondop left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, can you please correct the newline at the end of kube/Dockerfile before merging?

@parthchandra parthchandra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@andygrove

Copy link
Copy Markdown
Member Author

Looks good, can you please correct the newline at the end of kube/Dockerfile before merging?

I'll be following up with another PR almost immediately after merging this, so will include in that

@andygrove
andygrove merged commit 364887d into apache:main Aug 19, 2024
@andygrove
andygrove deleted the docker-publish branch August 19, 2024 22:54
@andygrove

Copy link
Copy Markdown
Member Author

Looks good, can you please correct the newline at the end of kube/Dockerfile before merging?

I'll be following up with another PR almost immediately after merging this, so will include in that

#851

Comment thread kube/Dockerfile
# if only Scala code gets modified
COPY rust-toolchain.toml /comet/rust-toolchain.toml
COPY native /comet/native
RUN cd native && RUSTFLAGS="-Ctarget-cpu=native" cargo build --release

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the -Ctarget-cpu=native a good idea? My guess would have been that github runners might use a range of different generations of cpus and therefore have different features? If that is the case different runs here might for example enable different simd instructions and cause varying performance.

Would it not be better to target some specific set of features and document that? And user what something else they should build from source.

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.

6 participants