From 59098f710e49b948f3290ef11475053214af1e2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E6=A0=91=E4=BA=BA?= Date: Thu, 18 Jan 2024 00:18:40 +0000 Subject: [PATCH] chore: add docker build script for builder --- .gitignore | 1 + Cargo.toml | 23 +++++++++++++++-------- Dockerfile | 10 ++++++++++ build.sh | 4 ++++ 4 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 Dockerfile create mode 100644 build.sh diff --git a/.gitignore b/.gitignore index 22f9367..74f9d79 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /um-react.exe /um-react@*.zip /um-react@*.exe +/*.gz diff --git a/Cargo.toml b/Cargo.toml index b9e102c..89e9f0a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,24 +6,31 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -wry = "0.35.1" -tao = { version = "0.24", default-features = false, features = ["rwh_05"] } -zip = "0.6.6" -http = "0.2" -bytes = "1.5.0" -clap = { version = "4.4.12", features = ["derive"] } -image = { version = "0.24", default-features = true, features = [ +wry = { version = "0.35.1", optional = true } +tao = { version = "0.24", default-features = false, optional = true, features = [ + "rwh_05", +] } +image = { version = "0.24", default-features = true, optional = true, features = [ "webp", "ico", ] } -dirs = "5.0.1" + +zip = { version = "0.6.6" } +http = { version = "0.2" } +bytes = { version = "1.5.0" } +clap = { version = "4.4.12", features = ["derive"] } +dirs = { version = "5.0.1" } [build-dependencies] winres = "0.1" +[features] +stub-pkgs = ["wry", "tao", "image"] + [[bin]] name = "um-react-wry-stub" path = "src/stub.rs" +required-features = ["stub-pkgs"] [[bin]] name = "builder" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2e5e38b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM rust + +ENV CARGO_HOME=/h +WORKDIR /c + +COPY src /c/src/ +COPY build.rs Cargo.toml Cargo.lock /c/ +RUN cargo build --bin builder --release + +CMD gzip < target/release/builder | base64 diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..81462e8 --- /dev/null +++ b/build.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +docker build -t wry-builder . +docker run --rm wry-builder | base64 -d >um-react-wry-builder-linux-amd64.gz