Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
vue/node_modules
vue/dist
vue/.vscode
src/ui/node_modules
src/ui/dist
src/ui/.vscode
target
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ centrifugo
*.tar.gz
*.env
*.http
/static
/dist
CLAUDE.md
75 changes: 7 additions & 68 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,74 +1,13 @@
[package]
[workspace]
resolver = "2"
members = [
"src/backend",
]

[workspace.package]
authors = ["[email protected]"]
description = "WebService providing access to omnect device features."
edition = "2024"
homepage = "https://www.omnect.io/home"
license = "MIT OR Apache-2.0"
name = "omnect-ui"
readme = "README.md"
repository = "[email protected]:omnect/omnect-ui.git"
version = "1.1.0"
build = "src/build.rs"

[dependencies]
actix-cors = { version = "0.7", default-features = false }
actix-files = { version = "0.6", default-features = false }
actix-multipart = { version = "0.7", default-features = false, features = [
"tempfile",
"derive"
] }
actix-server = { version = "2.6", default-features = false }
actix-session = { version = "0.11", features = ["cookie-session"] }
actix-web = { version = "4.11", default-features = false, features = [
"macros",
"rustls-0_23",
] }
actix-web-httpauth = { version = "0.8", default-features = false }
anyhow = { version = "1.0", default-features = false }
argon2 = { version = "0.5", default-features = false, features = ["password-hash", "alloc"] }
base64 = { version = "0.22", default-features = false }
env_logger = { version = "0.11", default-features = false }
jwt-simple = { version = "0.12", default-features = false, features = [
"optimal",
] }
log = { version = "0.4", default-features = false }
log-panics = { version = "2.1", default-features = false, features = [
"with-backtrace",
] }
mockall = { version = "0.13", optional = true, default-features = false }
rand_core = { version = "0.9", default-features = false, features = ["std"] }
reqwest = { version = "0.12.23", default-features = false, features = ["json", "rustls-tls"] }
rust-ini = { version = "0.21", default-features = false }
rustls = { version = "0.23", default-features = false, features = [
"aws_lc_rs",
"std",
"tls12",
] }
rustls-pemfile = { version = "2.2", default-features = false, features = [
"std",
] }
semver = { version = "1.0", default-features = false }
serde = { version = "1.0", default-features = false, features = ["derive"] }
serde_json = { version = "1.0", default-features = false, features = [
"raw_value",
] }
serde_repr = { version = "0.1", default-features = false }
serde_valid = { version = "2.0", default-features = false }
tokio = { version = "1.45", default-features = false, features = [
"macros",
"net",
"process",
] }
trait-variant = { version = "0.1", default-features = false }
uuid = { version = "1.17", default-features = false, features = [
"v4",
] }

[features]
mock = ["dep:mockall"]

[dev-dependencies]
actix-http = "3.11"
actix-service = "2.0"
mockall_double = "0.3"
tempfile = "3.20"
32 changes: 14 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ ARG DISTROLESS_IMAGE=gcr.io/distroless/base-debian12:nonroot

FROM oven/bun AS vue-install
RUN mkdir -p /tmp
COPY vue/package.json /tmp
COPY vue/bun.lock /tmp
COPY src/ui/package.json /tmp
COPY src/ui/bun.lock /tmp
RUN cd /tmp && bun install --frozen-lockfile

FROM oven/bun AS vue-build
WORKDIR /usr/src/app
COPY vue .
COPY src/ui .
COPY --from=vue-install /tmp/node_modules node_modules
RUN bun run build

Expand All @@ -34,22 +34,18 @@ RUN curl -sSLf https://centrifugal.dev/install.sh | sh

COPY --from=distroless /var/lib/dpkg/status.d /distroless_pkgs

RUN cargo new /work/omnect-ui
COPY Cargo.lock ./Cargo.lock
COPY Cargo.toml ./Cargo.toml
COPY src ./src

COPY Cargo.lock ./omnect-ui/Cargo.lock
COPY Cargo.toml ./omnect-ui/Cargo.toml
COPY src/build.rs ./omnect-ui/src/build.rs
RUN --mount=type=cache,target=/usr/local/cargo/registry cargo build ${OMNECT_UI_BUILD_ARG} --release -p omnect-ui --target-dir ./build

RUN --mount=type=cache,target=/usr/local/cargo/registry cd omnect-ui && cargo build ${OMNECT_UI_BUILD_ARG} --release --target-dir ./build

COPY src ./omnect-ui/src/
COPY .git ./omnect-ui/.git
COPY .git ./.git
RUN --mount=type=cache,target=/usr/local/cargo/registry <<EOF
set -e
# update timestamps to force a new build
touch /work/omnect-ui/src/main.rs
cd omnect-ui/
cargo build ${OMNECT_UI_BUILD_ARG} --release --target-dir ./build
touch /work/src/backend/src/main.rs
cargo build ${OMNECT_UI_BUILD_ARG} --release -p omnect-ui --target-dir ./build
EOF

SHELL ["/bin/bash", "-c"]
Expand All @@ -58,7 +54,7 @@ RUN <<EOT

mkdir -p /copy/status.d

executable=(omnect-ui/build/release/omnect-ui)
executable=(build/release/omnect-ui)

mkdir -p /copy/$(dirname "${executable}")
cp "${executable}" /copy/"${executable}"
Expand Down Expand Up @@ -99,13 +95,13 @@ RUN mkdir /cert

FROM ${DISTROLESS_IMAGE} AS base
COPY --from=builder --chown=10000:10000 /cert /cert
COPY --from=builder /work/omnect-ui/build/release/omnect-ui /
COPY --from=builder /work/build/release/omnect-ui /
COPY --from=builder /work/centrifugo /
COPY --from=builder /copy/lib/ /lib/
COPY --from=builder /copy/status.d /var/lib/dpkg/status.d
COPY --from=vue-build /usr/src/app/dist /static/
COPY --from=vue-build /usr/src/app/dist /dist/

WORKDIR "/"
COPY config/centrifugo_config.json /
COPY src/backend/config/centrifugo_config.json /

ENTRYPOINT [ "/omnect-ui" ]
Loading
Loading