|
| 1 | +name: docker extra |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + paths: |
| 7 | + - 'docker/mlflow/**' |
| 8 | + pull_request: |
| 9 | + branches: [ master ] |
| 10 | + paths: |
| 11 | + - 'docker/mlflow/**' |
| 12 | + |
| 13 | +env: |
| 14 | + REGISTRY: docker.io |
| 15 | + DOCKER_IMAGE_NAME: cogstacksystems/cogstack-mlflow-ui |
| 16 | + |
| 17 | +jobs: |
| 18 | + lint: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + container: hadolint/hadolint:latest-debian |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Lint |
| 25 | + run: hadolint --ignore DL3008 --ignore DL3013 --ignore DL3003 --ignore DL4006 docker/mlflow/**/Dockerfile* |
| 26 | + |
| 27 | + build-and-push: |
| 28 | + needs: lint |
| 29 | + if: | |
| 30 | + github.repository == 'CogStack/CogStack-ModelServe' && |
| 31 | + github.ref == 'refs/heads/master' && |
| 32 | + github.event_name == 'push' |
| 33 | + runs-on: ubuntu-latest |
| 34 | + permissions: |
| 35 | + contents: read |
| 36 | + packages: write |
| 37 | + id-token: write |
| 38 | + attestations: write |
| 39 | + concurrency: build-and-push |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + |
| 43 | + - name: Set up QEMU |
| 44 | + uses: docker/setup-qemu-action@v3 |
| 45 | + |
| 46 | + - name: Set up Docker Buildx |
| 47 | + uses: docker/setup-buildx-action@v3 |
| 48 | + |
| 49 | + - name: Login to Docker Hub |
| 50 | + uses: docker/login-action@v3 |
| 51 | + with: |
| 52 | + registry: ${{ env.REGISTRY }} |
| 53 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 54 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 55 | + |
| 56 | + - name: Cache Docker layers |
| 57 | + uses: actions/cache@v4 |
| 58 | + with: |
| 59 | + path: /tmp/.buildx-cache |
| 60 | + key: ${{ runner.os }}-buildx-${{ github.sha }} |
| 61 | + restore-keys: | |
| 62 | + ${{ runner.os }}-buildx- |
| 63 | +
|
| 64 | + - name: Build and push MLflow UI |
| 65 | + uses: docker/build-push-action@v6 |
| 66 | + id: build_and_push_mlflow_ui |
| 67 | + with: |
| 68 | + platforms: linux/amd64,linux/arm64 |
| 69 | + context: . |
| 70 | + file: docker/mlflow/server/Dockerfile |
| 71 | + push: true |
| 72 | + tags: | |
| 73 | + ${{ env.REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}:dev |
| 74 | + cache-from: type=local,src=/tmp/.buildx-cache |
| 75 | + cache-to: type=local,dest=/tmp/.buildx-cache,mode=max |
| 76 | + |
| 77 | + - name: Attest image artifacts |
| 78 | + uses: actions/attest-build-provenance@v2 |
| 79 | + id: attest |
| 80 | + with: |
| 81 | + subject-name: ${{ env.REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }} |
| 82 | + subject-digest: ${{ steps.build_and_push_mlflow_ui.outputs.digest }} |
| 83 | + push-to-registry: true |
0 commit comments