| name: Docker CD | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "Dockerfile" | |
| - ".dockerignore" | |
| - "docker-compose.yml" | |
| - "pyproject.toml" | |
| - "poetry.lock" | |
| jobs: | |
| docker: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Get version from pyproject.toml | |
| run: | | |
| echo "VERSION=$(grep '^version = ' pyproject.toml | cut -d'"' -f2)" >> $GITHUB_ENV | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: | | |
| jeff52415/llmdataparser:latest | |
| jeff52415/llmdataparser:v${{ env.VERSION }} | |
| cache-from: type=registry,ref=jeff52415/llmdataparser:latest | |
| cache-to: type=inline | |
| platforms: linux/amd64,linux/arm64 | |