feat: Generate crds in Dockerfile
Some checks failed
Build and deploy / build (push) Failing after 11m59s

This commit is contained in:
2025-12-21 06:40:17 +01:00
parent f1005138f4
commit 75c4b2a169
3 changed files with 15 additions and 5 deletions

View File

@@ -9,8 +9,8 @@ on:
jobs: jobs:
build: build:
uses: dreaded_x/workflows/.gitea/workflows/docker-kubernetes.yaml@ef78704b98c72e4a6b8340f9bff7b085a7bdd95c uses: dreaded_x/workflows/.gitea/workflows/docker-kubernetes.yaml@e0de3bb4b5b411956fbda235358240ba1e5ddc69
secrets: inherit secrets: inherit
with: with:
generate_crds: true
webhook_url: ${{ secrets.WEBHOOK_URL }} webhook_url: ${{ secrets.WEBHOOK_URL }}

View File

@@ -15,9 +15,11 @@ RUN cargo chef cook --release --recipe-path recipe.json
COPY . . COPY . .
ARG RELEASE_VERSION ARG RELEASE_VERSION
ENV RELEASE_VERSION=${RELEASE_VERSION} ENV RELEASE_VERSION=${RELEASE_VERSION}
RUN cargo auditable build --release RUN cargo auditable build --release && /app/target/release/crdgen > /crds.yaml
FROM scratch AS manifests
COPY --from=builder /crds.yaml /
FROM gcr.io/distroless/cc-debian12:nonroot AS runtime FROM gcr.io/distroless/cc-debian12:nonroot AS runtime
COPY --from=builder /app/target/release/lldap-controller /lldap-controller COPY --from=builder /app/target/release/lldap-controller /lldap-controller
COPY --from=builder /app/target/release/crdgen /crdgen
CMD ["/lldap-controller"] CMD ["/lldap-controller"]

View File

@@ -2,7 +2,7 @@ variable "TAG_BASE" {}
variable "RELEASE_VERSION" {} variable "RELEASE_VERSION" {}
group "default" { group "default" {
targets = ["lldap-controller"] targets = ["lldap-controller", "manifests"]
} }
target "docker-metadata-action" {} target "docker-metadata-action" {}
@@ -12,4 +12,12 @@ target "lldap-controller" {
context = "./" context = "./"
dockerfile = "Dockerfile" dockerfile = "Dockerfile"
tags = [for tag in target.docker-metadata-action.tags : "${TAG_BASE}:${tag}"] tags = [for tag in target.docker-metadata-action.tags : "${TAG_BASE}:${tag}"]
target = "runtime"
}
target "manifests" {
context = "./"
dockerfile = "Dockerfile"
target = "manifests"
output = [{ type = "cacheonly" }, "manifests"]
} }