-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #371 from topoteretes/COG-578
Push to docker hub
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: build | Build and Push Docker Image to DockerHub | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
docker-build-and-push: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Extract Git information | ||
id: git-info | ||
run: | | ||
echo "BRANCH_NAME=${GITHUB_REF_NAME}" >> "$GITHUB_ENV" | ||
echo "COMMIT_SHA=${GITHUB_SHA::7}" >> "$GITHUB_ENV" | ||
- name: Build and Push Docker Image | ||
run: | | ||
IMAGE_NAME=cognee/cognee | ||
TAG_VERSION="${BRANCH_NAME}-${COMMIT_SHA}" | ||
echo "Building image: ${IMAGE_NAME}:${TAG_VERSION}" | ||
docker buildx build \ | ||
--platform linux/amd64,linux/arm64 \ | ||
--push \ | ||
--tag "${IMAGE_NAME}:${TAG_VERSION}" \ | ||
--tag "${IMAGE_NAME}:latest" \ | ||
. | ||
- name: Verify pushed Docker images | ||
run: | | ||
# Verify both platform variants | ||
for PLATFORM in "linux/amd64" "linux/arm64"; do | ||
echo "Verifying image for $PLATFORM..." | ||
docker buildx imagetools inspect "${IMAGE_NAME}:${TAG_VERSION}" --format "{{.Manifest.$PLATFORM.Digest}}" | ||
done | ||
echo "Successfully verified images in Docker Hub" |