diff --git a/Dockerfile-server b/Dockerfile-server index 052ffd9..4477a3f 100644 --- a/Dockerfile-server +++ b/Dockerfile-server @@ -1,5 +1,8 @@ +FROM --platform=${BUILDPLATFORM:-linux/amd64} tonistiigi/xx AS xx FROM --platform=${BUILDPLATFORM:-linux/amd64} rust AS builder +COPY --from=xx / / + ARG TARGETPLATFORM ARG BUILDPLATFORM @@ -9,7 +12,7 @@ WORKDIR /roboscape_build COPY . . WORKDIR /roboscape_build/roboscapesim-server -RUN cargo b -r +RUN xx-cargo b -r FROM debian:bookworm-slim diff --git a/roboscapesim-server/src/util/util.rs b/roboscapesim-server/src/util/util.rs index 107ed30..57623e1 100644 --- a/roboscapesim-server/src/util/util.rs +++ b/roboscapesim-server/src/util/util.rs @@ -15,6 +15,7 @@ pub(crate) fn bool_val(val: &Value) -> bool { } } +/// Get string value from JSON value, with implicit conversion from other types pub(crate) fn str_val(val: &Value) -> String { match val { Value::Bool(b) => if *b { "true".to_string() } else { false.to_string() },