summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cargo/config.toml9
-rw-r--r--.gitattributes3
-rw-r--r--.gitignore4
-rw-r--r--Dockerfile2
-rw-r--r--Makefile19
-rw-r--r--src/authorization/server.rs3
6 files changed, 34 insertions, 6 deletions
diff --git a/.cargo/config.toml b/.cargo/config.toml
new file mode 100644
index 00000000..496c0f18
--- /dev/null
+++ b/.cargo/config.toml
@@ -0,0 +1,9 @@
+[source.crates-io]
+replace-with = "vendored-sources"
+
+[source."git+https://github.com/xlgmokha/please.git"]
+git = "https://github.com/xlgmokha/please.git"
+replace-with = "vendored-sources"
+
+[source.vendored-sources]
+directory = "vendor" \ No newline at end of file
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 00000000..62df66ae
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,3 @@
+vendor/** -diff -merge linguist-vendored gitlab-generated
+.cargo/** -diff -merge linguist-vendored gitlab-generated
+Cargo.lock -diff -merge linguist-vendored gitlab-generated
diff --git a/.gitignore b/.gitignore
index eb5a316c..4ea11ebf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,5 @@
target
+
+# Explicitly include vendor directory
+!vendor/
+!.cargo/
diff --git a/Dockerfile b/Dockerfile
index 744b4f3d..07f6f58a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -3,7 +3,7 @@ FROM rust:alpine AS builder
RUN apk add --no-cache musl-dev
WORKDIR /app
COPY . ./
-RUN cargo build --release --target x86_64-unknown-linux-musl
+RUN cargo build --release --target x86_64-unknown-linux-musl --offline
RUN strip /app/target/x86_64-unknown-linux-musl/release/authzd
FROM gcr.io/distroless/static-debian12:nonroot
diff --git a/Makefile b/Makefile
index dea71cfd..ca1a93db 100644
--- a/Makefile
+++ b/Makefile
@@ -2,15 +2,15 @@ PROJECT_NAME := $(shell basename $(shell pwd))
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD | sed 's/\//_/g')
IMAGE_TAG := $(PROJECT_NAME):$(GIT_BRANCH)
-.PHONY: build check test run clean fmt lint doc
+.PHONY: build check test run clean fmt lint doc vendor
.PHONY: build-image run-image health-check list-services test-grpc
setup:
@rustup component add clippy rustfmt
# Cargo targets
-build:
- @cargo build
+build: vendor
+ @cargo build --offline
check:
@cargo check
@@ -19,7 +19,7 @@ test:
@cargo test
run:
- @cargo run
+ @cargo run --offline
clean:
@cargo clean
@@ -33,8 +33,14 @@ lint:
doc:
@cargo doc --open
+vendor:
+ @cargo vendor
+
# Docker targets
-build-image:
+build-image: vendor
+ @docker build --tag $(IMAGE_TAG) .
+
+build-image-clean:
@docker build --no-cache --tag $(IMAGE_TAG) .
run-image: build-image
@@ -43,3 +49,6 @@ run-image: build-image
# gRPC testing targets
health-check:
@grpcurl -plaintext localhost:50051 grpc.health.v1.Health/Check
+
+list-services:
+ @grpcurl -plaintext localhost:50051 list
diff --git a/src/authorization/server.rs b/src/authorization/server.rs
index ded609da..2229163a 100644
--- a/src/authorization/server.rs
+++ b/src/authorization/server.rs
@@ -18,6 +18,9 @@ impl Server {
let reflection_service = tonic_reflection::server::Builder::configure()
.register_encoded_file_descriptor_set(tonic_health::pb::FILE_DESCRIPTOR_SET)
+ .register_encoded_file_descriptor_set(include_bytes!(
+ "../../vendor/envoy-types/src/generated/types.bin"
+ ))
.build_v1()?;
Ok(Self::new_with(|mut builder| {