Update base images in Dockerfile with dhi.io
#520
Workflow file for this run
This file contains hidden or 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
| name: ci | |
| on: | |
| # We run the CI checks on any pull request updates or pushes to the main branch after PR merge. | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| test-code: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout code in current PR branch | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Fetch all tags | |
| run: git fetch --force --tags | |
| - name: Set up Go | |
| uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: Run Go Vet | |
| run: go vet ./... | |
| - name: Run Go Tests | |
| run: go test ./... -cover -race | |
| - name: Build binary | |
| uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 | |
| with: | |
| distribution: goreleaser | |
| version: '~> v2' | |
| args: build --snapshot | |
| - name: Install license check tool | |
| run: go install github.com/google/addlicense@dc31ac9ffcca99c9457226366135701794b128c0 | |
| - name: Check licenses | |
| run: addlicense -l apache -check -v -ignore '**/*.yaml' -c 'The Score Authors' ./cmd ./internal/ | |
| test-container: | |
| runs-on: ubuntu-latest | |
| environment: ci-pr | |
| if: ${{ !github.event.pull_request.head.repo.fork }} | |
| steps: | |
| - name: checkout code in current PR branch | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Docker | |
| uses: docker/setup-docker-action@e61617a16c407a86262fb923c35a616ddbe070b3 # v4.6.0 | |
| with: | |
| daemon-config: | | |
| { | |
| "debug": true, | |
| "features": { | |
| "containerd-snapshotter": true | |
| } | |
| } | |
| - name: docker login for dhi.io | |
| uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 | |
| with: | |
| registry: dhi.io | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - name: docker login for Scout | |
| uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 | |
| with: | |
| registry: docker.io | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 | |
| - name: Build container image from PR branch | |
| uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 | |
| with: | |
| context: . | |
| push: false | |
| load: true | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| provenance: mode=max | |
| sbom: true | |
| tags: score-compose:pr-${{ github.event.number }} | |
| - name: docker images | |
| run: | | |
| docker images | |
| - name: checkout code in main branch | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| ref: main | |
| - name: Build container image from main branch | |
| uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 | |
| with: | |
| context: . | |
| push: false | |
| load: true | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| provenance: mode=max | |
| sbom: true | |
| tags: score-compose:main | |
| - name: docker images | |
| run: | | |
| docker images | |
| - name: Docker Scout Comparison between main branch and current PR branch | |
| uses: docker/scout-action@f8c776824083494ab0d56b8105ba2ca85c86e4de # v1.18.2 | |
| with: | |
| command: compare | |
| image: local://score-compose:pr-${{ github.event.number }} | |
| to: local://score-compose:main | |
| write-comment: true | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| organization: ${{ secrets.DOCKER_HUB_ORG }} | |
| - name: Test docker image built in PR branch | |
| run: | | |
| mkdir test | |
| sudo chown -R 65532:65532 test/ | |
| cd test | |
| docker run --rm score-compose:pr-${{ github.event.number }} --version | |
| docker run -v .:/score-compose --rm score-compose:pr-${{ github.event.number }} init | |
| cat score.yaml |