Build Docker Images #238
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: Build Docker Images | |
| on: | |
| pull_request: | |
| branches: | |
| - "main" | |
| push: | |
| branches: | |
| - "main" | |
| schedule: | |
| - cron: "0 21 * * 0" | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.head_ref || github.ref_name }} | |
| env: | |
| # dynamic doesn't work here, only static data | |
| REPOSITORY: | |
| TIGER_DOMAIN: clad-github-builder.rit.uw.edu | |
| YEAR: 2024 | |
| jobs: | |
| build-num: | |
| runs-on: self-hosted | |
| outputs: | |
| BUILD_NUM: ${{ steps.build_num.outputs.BUILD_NUM }} | |
| steps: | |
| - name: export BUILD_NUM to env | |
| id: build_num | |
| run: echo "BUILD_NUM=$(date +%Y%m%d%H%M%S)" >> "$GITHUB_OUTPUT" | |
| build-degauss: | |
| runs-on: self-hosted | |
| needs: build-num | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: import build_num | |
| run: echo "BUILD_NUM=${{ needs.build-num.outputs.BUILD_NUM }}" >> "$GITHUB_ENV" | |
| - name: print env | |
| run: env | sort | |
| - name: Build the degauss image | |
| run: docker build --output type=image,compression=zstd,compression-level=9,oci-mediatypes=true --load --cpu-quota $(( $(nproc --all)*100000 )) --platform linux/amd64 degauss --tag genoa-container-registry.washington.palantircloud.com/degauss:${{ env.BUILD_NUM }} | |
| - name: test container | |
| run: cp test/* /dev/shm/ && docker run --rm -v "/dev/shm":/opt/palantir/sidecars/shared-volumes/shared --entrypoint /geocode genoa-container-registry.washington.palantircloud.com/degauss:${{ env.BUILD_NUM }} /opt/palantir/sidecars/shared-volumes/shared/infile.csv all | |
| - name: Run Trivy CVE vulnerability scanner | |
| uses: aquasecurity/trivy-action@0.35.0 | |
| with: | |
| image-ref: genoa-container-registry.washington.palantircloud.com/degauss:${{ env.BUILD_NUM }} | |
| format: 'table' | |
| exit-code: '1' | |
| ignore-unfixed: true | |
| timeout: '1h' | |
| vuln-type: 'os,library' | |
| severity: 'CRITICAL,HIGH,MEDIUM' | |
| setup-postgis-states: | |
| runs-on: self-hosted | |
| needs: build-num | |
| outputs: | |
| matrix: ${{ steps.matrix.outputs.value }} | |
| steps: | |
| - id: matrix | |
| run: echo 'value=["ak", "al", "ar", "as", "az", "ca", "co", "ct", "dc", "de", "fl", "fm", "ga", "gu", "hi", "ia", "id", "il", "in", "ks", "ky", "la", "ma", "md", "me", "mh", "mi", "mn", "mo", "ms", "mt", "nc", "nd", "ne", "nh", "nj", "nm", "nv", "ny", "oh", "ok", "or", "pa", "pr", "pw", "ri", "sc", "sd", "tn", "tx", "ut", "va", "vi", "vt", "wa", "wi", "wv", "wy"]' >> $GITHUB_OUTPUT | |
| - run: echo "${{ steps.matrix.outputs.value }}" | |
| build-postgis-states: | |
| runs-on: self-hosted | |
| needs: [build-num, setup-postgis-states] | |
| continue-on-error: true | |
| strategy: | |
| matrix: | |
| value: ${{fromJSON(needs.setup-postgis-states.outputs.matrix)}} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: import build_num | |
| run: echo "BUILD_NUM=${{ needs.build-num.outputs.BUILD_NUM }}" >> "$GITHUB_ENV" | |
| - name: print env | |
| run: env | sort | |
| - name: Build the postgis image | |
| run: docker build --output type=image,compression=zstd,compression-level=9,oci-mediatypes=true --shm-size 4g --load --cpu-quota $(( $(nproc --all)*100000 )) --build-arg TIGER_DOMAIN=${{ env.TIGER_DOMAIN }} --build-arg YEAR=${{ env.YEAR }} --build-arg state_var=${{ matrix.value }} uwpostgis --platform linux/amd64 --tag genoa-container-registry.washington.palantircloud.com/postgis-${{ matrix.value }}:${{ env.BUILD_NUM }} | |
| - name: test container | |
| run: cp test/* /dev/shm/ && docker run --rm -v "/dev/shm":/opt/palantir/sidecars/shared-volumes/shared --entrypoint /geocode genoa-container-registry.washington.palantircloud.com/postgis-${{ matrix.value }}:${{ env.BUILD_NUM }} /opt/palantir/sidecars/shared-volumes/shared/infile.csv | |
| - name: Run Trivy CVE vulnerability scanner | |
| uses: aquasecurity/trivy-action@0.35.0 | |
| with: | |
| image-ref: genoa-container-registry.washington.palantircloud.com/postgis-${{ matrix.value }}:${{ env.BUILD_NUM }} | |
| format: 'table' | |
| exit-code: '1' | |
| ignore-unfixed: true | |
| timeout: '1h' | |
| vuln-type: 'os,library' | |
| severity: 'CRITICAL,HIGH,MEDIUM' |