Seeking a solution for cross-compiling from Win10 to Ubuntu server, preserving only executable files and select static files

Dev setup: Windows 10 + cargo
Target server: Ubuntu 22.04

Project structure: Static files related to respective .rs files are organized within subdirectories under the src folder in the cargo project, instead of being placed in a dedicated ‘static’ directory.

Question: What’s the optimal approach to cross-compile and deploy this setup to the server with just the executable(s) and specific static files?

Found the solution in the rustcc.cn(如何交叉编译到服务器上只保留可执行文件和若干静态文件 - Rust语言中文社区) Chinese forum, cross(GitHub - cross-rs/cross: “Zero setup” cross compilation and “cross testing” of Rust crates) is used for cross compilation, and rust-embed(GitHub - pyrossh/rust-embed: Rust Macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev.) is used for static file packaging.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.