Create dockerhub.yml
This commit is contained in:
parent
2f2aa81194
commit
b3bb4e82df
1 changed files with 46 additions and 0 deletions
46
.github/workflows/dockerhub.yml
vendored
Normal file
46
.github/workflows/dockerhub.yml
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
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@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Extract Git information
|
||||||
|
id: git-info
|
||||||
|
run: |
|
||||||
|
echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\\//-/g')" >> $GITHUB_ENV
|
||||||
|
echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> $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: |
|
||||||
|
echo "Successfully pushed images to Docker Hub"
|
||||||
Loading…
Add table
Reference in a new issue