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 docker build CICD #5

Merged
merged 18 commits into from
Nov 14, 2023
Merged

Add docker build CICD #5

merged 18 commits into from
Nov 14, 2023

Conversation

mrchtr
Copy link
Collaborator

@mrchtr mrchtr commented Nov 13, 2023

Add script to build and push the custom component to ghcr.io
Set the label to org.opencontainers.image.source=https://github.com/ml6team/fondant-usecase-RAG

@mrchtr mrchtr requested a review from RobbeSneyders November 13, 2023 12:36
on:
push:
branches:
- '*'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should be set to main before we merge it.

Copy link
Member

@RobbeSneyders RobbeSneyders left a comment

Choose a reason for hiding this comment

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

Thanks @mrchtr,

I think there's a few things in the script we need / might want to change for a script in the example repositories, see my comments. Maybe we should leverage fondant build instead?

Comment on lines 22 to 26
- name: Install docker pushrm
run: |
sudo wget https://github.com/christian-korneck/docker-pushrm/releases/download/v1.9.0/docker-pushrm_linux_amd64 -O /usr/libexec/docker/cli-plugins/docker-pushrm
sudo chmod +x /usr/libexec/docker/cli-plugins/docker-pushrm
docker pushrm --help
Copy link
Member

Choose a reason for hiding this comment

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

Does this work with github container registry?

I would be fine with leaving this out for the example images.

Copy link
Member

Choose a reason for hiding this comment

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

Seems like it's not used in the script.

echo "Freezing Fondant dependency version to ${tags[0]}"

docker build --push "${args[@]}" \
--build-arg="FONDANT_VERSION=${tags[0]}" \
Copy link
Member

Choose a reason for hiding this comment

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

Custom docker files don't contain the FONDANT_VERSION build argument.

Comment on lines 91 to 98
# Add cache arguments if caching is enabled
if [ "$caching" = true ] ; then

cache_name=ghcr.io/${namespace}/${BASENAME}:build-cache
echo "Caching from/to ${cache_name}"
args+=(--cache-to "type=registry,ref=${cache_name}")
args+=(--cache-from "type=registry,ref=${cache_name}")
fi
Copy link
Member

Choose a reason for hiding this comment

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

I would leave out caching for custom images. It adds a lot of complexity while it's mostly useful when you have a lot of images.

Comment on lines 80 to 82
echo "Updating the image version in the fondant_component.yaml with:"
echo "${full_image_names[0]}"
sed -i -e "s|^image: .*|image: ${full_image_names[0]}|" fondant_component.yaml
Copy link
Member

Choose a reason for hiding this comment

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

This is not needed for CI/CD, and for other usage, their's now the fondant build command.

full_image_names=()
echo "Tagging image with following tags:"
for tag in "${tags[@]}"; do
full_image_name=ghcr.io/${namespace}/${BASENAME}:${tag}
Copy link
Member

Choose a reason for hiding this comment

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

We might want to keep the registry parametrized so users can easily switch to a different registry.

Comment on lines 12 to 13
echo " -r, --registry <value> The docker registry prefix to use (default: null for DockerHub)"
echo " -n, --namespace <value> The DockerHub namespace for the built images (default: fndnt)"
Copy link
Member

Choose a reason for hiding this comment

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

Some outdated documentation here

Copy link
Member

@RobbeSneyders RobbeSneyders left a comment

Choose a reason for hiding this comment

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

Thanks @mrchtr!

Seems to be working 👍
Can you update the branch name in the workflow before merging?

scripts/build_components.sh Outdated Show resolved Hide resolved
@mrchtr mrchtr merged commit b09a974 into main Nov 14, 2023
1 check passed
@mrchtr mrchtr deleted the add-docker-build-cicd branch November 14, 2023 13:40
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