2022-04-14 05:14:13 +05:30
|
|
|
name: Artifacts
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
tags:
|
|
|
|
- v[0-9]+.[0-9]+.[0-9]+
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
container-images:
|
|
|
|
name: Container images
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-04-14 19:05:32 +05:30
|
|
|
variant:
|
|
|
|
- alpine
|
|
|
|
- distroless
|
2022-04-14 05:14:13 +05:30
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
2022-04-22 18:27:58 +05:30
|
|
|
- name: Gather metadata
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v3
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
ghcr.io/dexidp/dex
|
|
|
|
dexidp/dex
|
|
|
|
flavor: |
|
|
|
|
latest = false
|
|
|
|
tags: |
|
|
|
|
type=ref,event=branch,enable=${{ matrix.variant == 'alpine' }}
|
|
|
|
type=ref,event=pr,enable=${{ matrix.variant == 'alpine' }}
|
|
|
|
type=semver,pattern={{raw}},enable=${{ matrix.variant == 'alpine' }}
|
|
|
|
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && matrix.variant == 'alpine' }}
|
|
|
|
type=ref,event=branch,suffix=-${{ matrix.variant }}
|
|
|
|
type=ref,event=pr,suffix=-${{ matrix.variant }}
|
|
|
|
type=semver,pattern={{raw}},suffix=-${{ matrix.variant }}
|
|
|
|
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }},suffix=-${{ matrix.variant }}
|
|
|
|
labels: |
|
|
|
|
org.opencontainers.image.documentation=https://dexidp.io/docs/
|
|
|
|
|
2022-04-14 05:14:13 +05:30
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
with:
|
2022-04-22 17:45:04 +05:30
|
|
|
platforms: all
|
2022-04-14 05:14:13 +05:30
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
|
|
|
- name: Login to GitHub Container Registry
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ github.token }}
|
|
|
|
if: github.event_name == 'push'
|
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
if: github.event_name == 'push'
|
|
|
|
|
|
|
|
- name: Build and push
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
context: .
|
2022-04-22 17:45:04 +05:30
|
|
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
2022-05-14 19:20:29 +05:30
|
|
|
# cache-from: type=gha
|
|
|
|
# cache-to: type=gha,mode=max
|
2022-04-14 05:14:13 +05:30
|
|
|
push: ${{ github.event_name == 'push' }}
|
2022-04-23 01:46:56 +05:30
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
2022-04-14 05:14:13 +05:30
|
|
|
build-args: |
|
2022-04-14 19:05:32 +05:30
|
|
|
BASE_IMAGE=${{ matrix.variant }}
|
2022-04-23 01:46:56 +05:30
|
|
|
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
|
|
|
|
COMMIT_HASH=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
|
|
|
|
BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
2022-04-14 05:14:13 +05:30
|
|
|
|
|
|
|
- name: Run Trivy vulnerability scanner
|
2022-04-19 09:38:41 +05:30
|
|
|
uses: aquasecurity/trivy-action@0.2.5
|
2022-04-14 05:14:13 +05:30
|
|
|
with:
|
2022-04-23 01:46:56 +05:30
|
|
|
image-ref: "ghcr.io/dexidp/dex:${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}"
|
2022-04-14 18:38:26 +05:30
|
|
|
format: "sarif"
|
2022-04-14 05:14:13 +05:30
|
|
|
output: "trivy-results.sarif"
|
2022-04-22 17:51:28 +05:30
|
|
|
if: github.event_name == 'push'
|
2022-04-14 05:14:13 +05:30
|
|
|
|
|
|
|
- name: Upload Trivy scan results to GitHub Security tab
|
2022-04-26 09:39:06 +05:30
|
|
|
uses: github/codeql-action/upload-sarif@v2
|
2022-04-14 05:14:13 +05:30
|
|
|
with:
|
|
|
|
sarif_file: "trivy-results.sarif"
|
2022-04-22 17:51:28 +05:30
|
|
|
if: github.event_name == 'push'
|