|
@@ -0,0 +1,81 @@
|
|
|
|
+# dev
|
|
|
|
+
|
|
|
|
+## 构建开发容器
|
|
|
|
+
|
|
|
|
+.devcontainer\Dockerfile
|
|
|
|
+```
|
|
|
|
+# 安装依赖
|
|
|
|
+RUN sudo apt update -y && sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake unzip zip sudo libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
|
|
|
|
+
|
|
|
|
+# 安装vcpkg
|
|
|
|
+RUN git clone https://github.com/microsoft/vcpkg
|
|
|
|
+WORKDIR vcpkg
|
|
|
|
+RUN git checkout 2023.04.15
|
|
|
|
+RUN /vcpkg/bootstrap-vcpkg.sh -disableMetrics
|
|
|
|
+ENV VCPKG_ROOT=/vcpkg
|
|
|
|
+
|
|
|
|
+# 安装rust
|
|
|
|
+RUN wget https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.lnx/x64/libsciter-gtk.so
|
|
|
|
+RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh
|
|
|
|
+RUN chmod +x rustup.sh
|
|
|
|
+RUN $HOME/rustup.sh -y
|
|
|
|
+
|
|
|
|
+# 安装flutter 3.10.1
|
|
|
|
+RUN wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.10.1-stable.tar.xz
|
|
|
|
+RUN tar xf flutter_linux_3.10.1-stable.tar.xz && rm flutter_linux_3.10.1-stable.tar.xz
|
|
|
|
+ENV PATH="$PATH:$HOME/flutter/bin"
|
|
|
|
+
|
|
|
|
+```
|
|
|
|
+
|
|
|
|
+在 .devcontainer\devcontainer.json 配置镜像,并设置初始化脚本 .devcontainer\build.sh ,以及默认插件,默认执行:
|
|
|
|
+
|
|
|
|
+```
|
|
|
|
+build(){
|
|
|
|
+ pwd
|
|
|
|
+ $WORKDIR/entrypoint $1
|
|
|
|
+}
|
|
|
|
+```
|
|
|
|
+构建镜像较久,首次启动会很慢。
|
|
|
|
+
|
|
|
|
+配置国内镜像:
|
|
|
|
+```
|
|
|
|
+RUN sed -i "s/deb.debian.org/mirrors.163.com/g" /etc/apt/sources.list
|
|
|
|
+RUN sed -i "s/security.debian.org/mirrors.163.com/g" /etc/apt/sources.list
|
|
|
|
+
|
|
|
|
+RUN echo '[source.crates-io]' > ~/.cargo/config \
|
|
|
|
+ && echo 'registry = "https://github.com/rust-lang/crates.io-index"' >> ~/.cargo/config \
|
|
|
|
+ && echo '# 替换成你偏好的镜像源' >> ~/.cargo/config \
|
|
|
|
+ && echo "replace-with = 'sjtu'" >> ~/.cargo/config \
|
|
|
|
+ && echo '# 上海交通大学' >> ~/.cargo/config \
|
|
|
|
+ && echo '[source.sjtu]' >> ~/.cargo/config \
|
|
|
|
+ && echo 'registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"' >> ~/.cargo/config \
|
|
|
|
+ && echo '' >> ~/.cargo/config
|
|
|
|
+
|
|
|
|
+ENV http_proxy=http://host:port
|
|
|
|
+ENV https_proxy=http://host:port
|
|
|
|
+```
|
|
|
|
+
|
|
|
|
+构建镜像:
|
|
|
|
+```
|
|
|
|
+docker build -t "rustdesk-builder" . --build-arg http_proxy=http://host:port --build-arg https_proxy=http://host:port
|
|
|
|
+
|
|
|
|
+docker run --rm -it -v $PWD:/home/user/rustdesk -v rustdesk-git-cache:/home/user/.cargo/git -v rustdesk-registry-cache:/home/user/.cargo/registry -e PUID="$(id -u)" -e PGID="$(id -g)" rustdesk-builder
|
|
|
|
+
|
|
|
|
+# 运行
|
|
|
|
+./target/debug/rustdesk
|
|
|
|
+```
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+## 构建本地开发环境
|
|
|
|
+
|
|
|
|
+依照dockerfile中参考,安装并构建:
|
|
|
|
+
|
|
|
|
+```
|
|
|
|
+git clone https://github.com/rustdesk/rustdesk
|
|
|
|
+cd rustdesk
|
|
|
|
+mkdir -p target/debug
|
|
|
|
+wget https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.win/x64/sciter.dll
|
|
|
|
+mv sciter.dll target/debug
|
|
|
|
+cargo run
|
|
|
|
+
|
|
|
|
+```
|