mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 12:37:00 +01:00
Improve docker pipelines
This commit is contained in:
parent
117b91eef4
commit
7faa77b2b8
37
.github/workflows/docker_build_kanidm.yml
vendored
37
.github/workflows/docker_build_kanidm.yml
vendored
|
@ -35,9 +35,30 @@ jobs:
|
||||||
needs:
|
needs:
|
||||||
- set_tag_values
|
- set_tag_values
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Docker metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
prefix-key: v0-rust-linux/amd64-base
|
||||||
|
id: rust-cache
|
||||||
|
- name: Inject cache into Docker
|
||||||
|
uses: reproducible-containers/buildkit-cache-dance@v3.1.2
|
||||||
|
with:
|
||||||
|
cache-map: |
|
||||||
|
{
|
||||||
|
"/home/runner/.cargo/registry": "/usr/local/cargo/registry",
|
||||||
|
"/home/runner/.cargo/git/db": "/usr/local/cargo/git/db",
|
||||||
|
"./target": "/app/target"
|
||||||
|
}
|
||||||
|
- name: Get Git commit timestamps
|
||||||
|
run: echo "TIMESTAMP=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
|
||||||
- name: Build kanidm
|
- name: Build kanidm
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
|
@ -47,8 +68,16 @@ jobs:
|
||||||
build-args: |
|
build-args: |
|
||||||
"KANIDM_FEATURES="
|
"KANIDM_FEATURES="
|
||||||
file: tools/Dockerfile
|
file: tools/Dockerfile
|
||||||
|
context: .
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
annotations: ${{ steps.meta.outputs.annotations }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
sbom: true
|
||||||
# Must use OCI exporter for multi-arch: https://github.com/docker/buildx/pull/1813
|
# Must use OCI exporter for multi-arch: https://github.com/docker/buildx/pull/1813
|
||||||
outputs: type=oci,dest=/tmp/kanidm-docker.tar
|
outputs: type=oci,dest=/tmp/kanidm-docker.tar
|
||||||
|
env:
|
||||||
|
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
@ -60,8 +89,8 @@ jobs:
|
||||||
# This step is split so that we don't apply "packages: write" permission
|
# This step is split so that we don't apply "packages: write" permission
|
||||||
# except when uploading the final Docker image to GHCR.
|
# except when uploading the final Docker image to GHCR.
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ( github.ref_type == 'tag' || github.ref == 'refs/heads/master' ) && github.repository == 'kanidm/kanidm'
|
if: ( github.ref_type == 'tag' || github.ref == 'refs/heads/master' )
|
||||||
needs: kanidm_build
|
needs: [kanidm_build, set_tag_values]
|
||||||
permissions:
|
permissions:
|
||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
|
@ -78,4 +107,4 @@ jobs:
|
||||||
echo "${{ secrets.GITHUB_TOKEN }}" | \
|
echo "${{ secrets.GITHUB_TOKEN }}" | \
|
||||||
oras login -u "${{ github.actor }}" --password-stdin ghcr.io
|
oras login -u "${{ github.actor }}" --password-stdin ghcr.io
|
||||||
oras copy --from-oci-layout "/tmp/kanidm-docker.tar:devel" \
|
oras copy --from-oci-layout "/tmp/kanidm-docker.tar:devel" \
|
||||||
"ghcr.io/${{ github.repository_owner }}/kanidm:devel"
|
"ghcr.io/${{ needs.set_tag_values.outputs.owner_lc }}/kanidm:devel"
|
47
.github/workflows/docker_build_kanidmd.yml
vendored
47
.github/workflows/docker_build_kanidmd.yml
vendored
|
@ -35,27 +35,30 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: set_tag_values
|
needs: set_tag_values
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
- name: Docker metadata
|
- name: Docker metadata
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
# list of Docker images to use as base name for tags
|
prefix-key: v0-rust-linux/amd64-base
|
||||||
# images: |
|
id: rust-cache
|
||||||
# kanidm/kanidmd
|
- name: Inject cache into Docker
|
||||||
# ghcr.io/username/app
|
uses: reproducible-containers/buildkit-cache-dance@v3.1.2
|
||||||
# generate Docker tags based on the following events/attributes
|
with:
|
||||||
tags: |
|
cache-map: |
|
||||||
type=schedule
|
{
|
||||||
type=ref,event=branch
|
"/home/runner/.cargo/registry": "/usr/local/cargo/registry",
|
||||||
type=ref,event=pr
|
"/home/runner/.cargo/git/db": "/usr/local/cargo/git/db",
|
||||||
type=semver,pattern={{version}}
|
"./target": "/app/target"
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
}
|
||||||
type=semver,pattern={{major}}
|
- name: Get Git commit timestamps
|
||||||
type=sha
|
run: echo "TIMESTAMP=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Build kanidmd
|
- name: Build kanidmd
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
|
@ -64,8 +67,16 @@ jobs:
|
||||||
# build-args: |
|
# build-args: |
|
||||||
# "KANIDM_BUILD_OPTIONS=-j1"
|
# "KANIDM_BUILD_OPTIONS=-j1"
|
||||||
file: server/Dockerfile
|
file: server/Dockerfile
|
||||||
|
context: .
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
annotations: ${{ steps.meta.outputs.annotations }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
sbom: true
|
||||||
# Must use OCI exporter for multi-arch: https://github.com/docker/buildx/pull/1813
|
# Must use OCI exporter for multi-arch: https://github.com/docker/buildx/pull/1813
|
||||||
outputs: type=oci,dest=/tmp/kanidmd-docker.tar
|
outputs: type=oci,dest=/tmp/kanidmd-docker.tar
|
||||||
|
env:
|
||||||
|
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
@ -77,8 +88,8 @@ jobs:
|
||||||
# This step is split so that we don't apply "packages: write" permission
|
# This step is split so that we don't apply "packages: write" permission
|
||||||
# except when uploading the final Docker image to GHCR.
|
# except when uploading the final Docker image to GHCR.
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ( github.ref_type== 'tag' || github.ref == 'refs/heads/master' ) && github.repository == 'kanidm/kanidm'
|
if: ( github.ref_type== 'tag' || github.ref == 'refs/heads/master' )
|
||||||
needs: kanidmd_build
|
needs: [kanidmd_build, set_tag_values]
|
||||||
permissions:
|
permissions:
|
||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
|
@ -95,4 +106,4 @@ jobs:
|
||||||
echo "${{ secrets.GITHUB_TOKEN }}" | \
|
echo "${{ secrets.GITHUB_TOKEN }}" | \
|
||||||
oras login -u "${{ github.actor }}" --password-stdin ghcr.io
|
oras login -u "${{ github.actor }}" --password-stdin ghcr.io
|
||||||
oras copy --from-oci-layout "/tmp/kanidmd-docker.tar:devel" \
|
oras copy --from-oci-layout "/tmp/kanidmd-docker.tar:devel" \
|
||||||
"ghcr.io/${{ github.repository_owner }}/kanidmd:devel"
|
"ghcr.io/${{ needs.set_tag_values.outputs.owner_lc }}/kanidmd:devel"
|
23
.github/workflows/docker_build_radiusd.yml
vendored
23
.github/workflows/docker_build_radiusd.yml
vendored
|
@ -35,19 +35,34 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: set_tag_values
|
needs: set_tag_values
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Docker metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
- name: Get Git commit timestamps
|
||||||
|
run: echo "TIMESTAMP=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
|
||||||
- name: Build radius
|
- name: Build radius
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
platforms: linux/arm64,linux/amd64
|
platforms: linux/arm64,linux/amd64
|
||||||
tags: ghcr.io/${{ needs.set_tag_values.outputs.owner_lc }}/radius:devel,ghcr.io/${{ needs.set_tag_values.outputs.owner_lc }}/radius:${{ needs.set_tag_values.outputs.ref_name}}
|
tags: ghcr.io/${{ needs.set_tag_values.outputs.owner_lc }}/radius:devel,ghcr.io/${{ needs.set_tag_values.outputs.owner_lc }}/radius:${{ needs.set_tag_values.outputs.ref_name}}
|
||||||
file: rlm_python/Dockerfile
|
file: rlm_python/Dockerfile
|
||||||
|
context: .
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
annotations: ${{ steps.meta.outputs.annotations }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
# Must use OCI exporter for multi-arch: https://github.com/docker/buildx/pull/1813
|
# Must use OCI exporter for multi-arch: https://github.com/docker/buildx/pull/1813
|
||||||
outputs: type=oci,dest=/tmp/radius-docker.tar
|
outputs: type=oci,dest=/tmp/radius-docker.tar
|
||||||
|
env:
|
||||||
|
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
@ -59,8 +74,8 @@ jobs:
|
||||||
# This step is split so that we don't apply "packages: write" permission
|
# This step is split so that we don't apply "packages: write" permission
|
||||||
# except when uploading the final Docker image to GHCR.
|
# except when uploading the final Docker image to GHCR.
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ( github.ref_type == 'tag' || github.ref == 'refs/heads/master' ) && github.repository == 'kanidm/kanidm'
|
if: ( github.ref_type == 'tag' || github.ref == 'refs/heads/master' )
|
||||||
needs: radius_build
|
needs: [radius_build, set_tag_values]
|
||||||
permissions:
|
permissions:
|
||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
|
@ -79,4 +94,4 @@ jobs:
|
||||||
echo "${{ secrets.GITHUB_TOKEN }}" | \
|
echo "${{ secrets.GITHUB_TOKEN }}" | \
|
||||||
oras login -u "${{ github.actor }}" --password-stdin ghcr.io
|
oras login -u "${{ github.actor }}" --password-stdin ghcr.io
|
||||||
oras copy --from-oci-layout "/tmp/radius-docker.tar:devel" \
|
oras copy --from-oci-layout "/tmp/radius-docker.tar:devel" \
|
||||||
"ghcr.io/${{ github.repository_owner }}/radius:devel"
|
"ghcr.io/${{ needs.set_tag_values.outputs.owner_lc }}/radius:devel"
|
Loading…
Reference in a new issue