Compare commits

..

5 Commits

Author SHA1 Message Date
eaa96d1d5b
Add attestations to image
All checks were successful
Build and deploy / Build container and manifests (push) Successful in 7m27s
2025-03-21 03:38:45 +01:00
847927364f
Add annotations instead of labels to image 2025-03-21 03:36:45 +01:00
1e278e592f
Set SOURCE_DATE_EPOCH during image build 2025-03-21 03:36:14 +01:00
85da15881e
Switched to nonroot distroless base and improved layer caching 2025-03-21 03:34:30 +01:00
21bb89a20f
Switch to hadolint for linting Dockerfile 2025-03-21 03:24:06 +01:00
3 changed files with 34 additions and 14 deletions

View File

@ -18,6 +18,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Get Git commit timestamps
run: echo "TIMESTAMP=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
- name: Login to registry
uses: docker/login-action@v3
with:
@ -55,11 +58,13 @@ jobs:
with:
context: .
load: true
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
env:
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
- name: Generate CRDs
run: |
docker run --rm ${{ steps.build.outputs.imageid }} crdgen > ./manifests/crds.yaml
docker run --rm ${{ steps.build.outputs.imageid }} /crdgen > ./manifests/crds.yaml
- name: Push container
uses: docker/build-push-action@v6
@ -67,8 +72,12 @@ jobs:
with:
context: .
push: true
sbom: true
provenance: mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
env:
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
- name: Kustomize manifests
run: |

View File

@ -56,7 +56,7 @@ repos:
files: (\.rs|Cargo.lock)$
pass_filenames: false
- repo: https://github.com/pryorda/dockerfilelint-precommit-hooks
rev: v0.1.0
- repo: https://github.com/hadolint/hadolint
rev: v2.12.0
hooks:
- id: dockerfilelint
- id: hadolint

View File

@ -1,9 +1,20 @@
FROM rust:1.85 AS builder
WORKDIR /usr/src/lldap-controller
ADD . .
RUN cargo install --path .
FROM rust:1.85 AS chef
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
RUN cargo install cargo-chef --locked --version 0.1.71
WORKDIR /app
FROM debian:bookworm-slim
COPY --from=builder /usr/local/cargo/bin/lldap-controller /usr/local/bin/lldap-controller
COPY --from=builder /usr/local/cargo/bin/crdgen /usr/local/bin/crdgen
CMD ["lldap-controller"]
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN cargo build --release
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/crdgen /crdgen
CMD ["/lldap-controller"]