Skip to content

Commit

Permalink
Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
UMR1352 committed Nov 28, 2023
1 parent d2eab5e commit ced3172
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
target/
bindings/wasm/
bindings/grpc/target/
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM rust:bookworm as builder

# install protobuf
RUN apt-get update && apt-get install -y protobuf-compiler libprotobuf-dev musl-tools

COPY . /usr/src/app/
WORKDIR /usr/src/app/bindings/grpc
RUN rustup target add x86_64-unknown-linux-musl
RUN cargo build --target x86_64-unknown-linux-musl --release --bin identity-grpc

FROM gcr.io/distroless/static-debian11 as runner

# get binary
COPY --from=builder /usr/src/app/bindings/grpc/target/x86_64-unknown-linux-musl/release/identity-grpc /

# set run env
EXPOSE 50051

# run it
CMD ["/identity-grpc"]
4 changes: 3 additions & 1 deletion bindings/grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
anyhow = "1.0.75"
tokio-stream = { version = "0.1.14", features = ["net"] }
identity_iota = { path = "../../identity_iota", features = ["resolver"] }
identity_storage = { path = "../../identity_storage", features = ["memstore"] }
iota-sdk = { version = "1.1.2", features = ["stronghold"] }
serde_json = { version = "1.0.108", features = ["alloc"] }
thiserror = "1.0.50"
rand = "0.8.5"
serde = { version = "1.0.193", features = ["derive", "alloc"] }

[dev-dependencies]
identity_storage = { path = "../../identity_storage", features = ["memstore"] }

[build-dependencies]
tonic-build = "0.10"
8 changes: 5 additions & 3 deletions bindings/grpc/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
use anyhow::Context;
use identity_grpc::server::GRpcServer;
use iota_sdk::client::Client;

const API_ENDPOINT: &str = "http://127.0.0.1:14265";

#[tokio::main]
async fn main() -> anyhow::Result<()> {
let api_endpoint = std::env::var("API_ENDPOINT")
.context("Missing environmental variable API_ENDPOINT")?;

let client: Client = Client::builder()
.with_primary_node(API_ENDPOINT, None)?
.with_primary_node(&api_endpoint, None)?
.finish()
.await?;

Expand Down
1 change: 1 addition & 0 deletions bindings/grpc/src/services/credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ mod credential_verification {

#[derive(Debug, Error, Serialize, Deserialize)]
#[serde(tag = "error_type", content = "reason")]
#[serde(rename_all = "snake_case")]
pub enum RevocationCheckError {
#[error("Unknown revocation type {0}")]
UnknownRevocationType(String),
Expand Down

0 comments on commit ced3172

Please sign in to comment.