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

chore: Add GitHub workflow to publish Docker image #847

Merged
merged 16 commits into from
Aug 19, 2024

Conversation

andygrove
Copy link
Member

@andygrove andygrove commented Aug 19, 2024

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
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
Copy link
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
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
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
kube/Dockerfile Outdated Show resolved Hide resolved
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
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
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

Copy link
Contributor

@edmondop edmondop Aug 19, 2024

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
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

Copy link
Contributor

@comphead comphead left a comment

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

docker push ghcr.io/apache/datafusion-comet:$DOCKER_TAG
env:
DOCKER_USER: ${{ github.actor }}
DOCKER_PASS: ${{ secrets.GITHUB_TOKEN }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing newline here

.github/workflows/docker-publish.yml Outdated Show resolved Hide resolved

# 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
Copy link
Contributor

Choose a reason for hiding this comment

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

Newline at EOF

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
Contributor

@edmondop edmondop Aug 19, 2024

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

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.

Copy link
Contributor

@edmondop edmondop left a comment

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?

Copy link
Contributor

@parthchandra parthchandra left a comment

Choose a reason for hiding this comment

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

lgtm

@andygrove
Copy link
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
74 checks passed
@andygrove andygrove deleted the docker-publish branch August 19, 2024 22:54
@andygrove
Copy link
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

# 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
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