|
name: Docker CD |
|
|
|
on: |
|
push: |
|
branches: [main] |
|
paths: |
|
- "Dockerfile" |
|
- ".dockerignore" |
|
- "docker-compose.yml" |
|
- "pyproject.toml" |
|
- "poetry.lock" |
|
pull_request: |
|
branches: [main] |
|
paths: |
|
- "Dockerfile" |
|
- ".dockerignore" |
|
- "docker-compose.yml" |
|
- "pyproject.toml" |
|
- "poetry.lock" |
|
|
|
jobs: |
|
docker: |
|
|
|
|
|
|
|
if: github.event_name == 'push' || github.event_name == 'pull_request' |
|
runs-on: ubuntu-latest |
|
steps: |
|
- name: Checkout |
|
uses: actions/checkout@v4 |
|
|
|
- name: Set up Docker Buildx |
|
uses: docker/setup-buildx-action@v3 |
|
|
|
|
|
- name: Login to Docker Hub |
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
|
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: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} |
|
tags: jeff52415/llmdataparser:latest |
|
cache-from: type=registry,ref=jeff52415/llmdataparser:latest |
|
cache-to: type=inline |
|
|