docker testing + setup hosting dx app via aspnet

This commit is contained in:
2025-05-18 00:06:23 -04:00
parent 34c050384b
commit 24ddb19013
10 changed files with 150 additions and 3275 deletions

6
AobaClient/.dockerignore Normal file
View File

@@ -0,0 +1,6 @@
**/target
**/dist
LICENSES
LICENSE
temp
README.md

3323
AobaClient/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,8 +2,7 @@
name = "aoba-client"
version = "0.1.0"
authors = ["Amatsugu <khamraj@kaisei.app>"]
edition = "2021"
edition = "2024"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
@@ -16,7 +15,6 @@ tonic = { version = "*", default-features = false, features = [
] }
prost = "0.13"
tonic-web-wasm-client = "0.7"
js-sys = { version = "0.3.77" }
web-sys = { version = "0.3.77", features = ["Storage", "Window"] }
[build-dependencies]
@@ -25,8 +23,6 @@ tonic-build = { version = "*", default-features = false, features = ["prost"] }
[features]
default = ["web"]
web = ["dioxus/web"]
desktop = ["dioxus/desktop"]
mobile = ["dioxus/mobile"]
[profile]

44
AobaClient/Dockerfile Normal file
View File

@@ -0,0 +1,44 @@
FROM rust:1 AS chef
RUN rustup target add wasm32-unknown-unknown
RUN cargo install cargo-chef
WORKDIR /app
FROM chef AS planner
COPY . .
WORKDIR /app/AobaClient
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
WORKDIR /app/AobaClient
COPY --from=planner /app/AobaClient/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY /AobaClient /app/AobaClient
COPY /AobaServer/Proto /app/AobaServer/Proto
# Install Protobuf
RUN apt update
RUN apt install -y protobuf-compiler libprotobuf-dev
# Install `dx`
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
RUN cargo binstall dioxus-cli --root /.cargo -y --force
ENV PATH="/.cargo/bin:$PATH"
# Create the final bundle folder. Bundle always executes in release mode with optimizations enabled
RUN dx bundle --platform web
ENTRYPOINT [ "sleep", "infinity" ]
# FROM chef AS runtime
# COPY --from=builder /app/AobaClient/target/dx/aoba-client/release/web/ /usr/local/app
# # set our port and make sure to listen for all connections
# ENV PORT=8616
# ENV IP=0.0.0.0
# # expose the port 8080
# EXPOSE 8616
# WORKDIR /usr/local/app
# ENTRYPOINT [ "/usr/local/app/server" ]

View File

@@ -3,8 +3,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.build_server(false)
.build_client(true)
.compile_protos(
&["..\\AobaServer\\Proto\\Aoba.proto", "..\\AobaServer\\Proto\\Auth.proto"],
&["..\\AobaServer\\Proto\\"],
&["../AobaServer/Proto/Aoba.proto", "../AobaServer/Proto/Auth.proto"],
&["../AobaServer/Proto/"],
)?;
Ok(())