diff --git a/.gitignore b/.gitignore index a385252..76901e2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ /.idea /.vscode /target -/artifacts +**/artifacts .intentionally-empty-file.o *.swp diff --git a/identity-server/justfile b/identity-server/justfile new file mode 100644 index 0000000..22cc74c --- /dev/null +++ b/identity-server/justfile @@ -0,0 +1,34 @@ +# Define variables +artifacts_dir := "artifacts" +target_dir := "../target" +package_name := "identity-server" +targets := ("x86_64-unknown-linux-musl" ++ "aarch64-unknown-linux-musl" ++ "x86_64-pc-windows-gnu" ++ "aarch64-apple-darwin") + +default: all + +# Build Rust binaries for different targets +rust-build: + cargo-zigbuild build --profile artifact -p {{package_name}} --target aarch64-apple-darwin --target x86_64-pc-windows-gnu --target aarch64-unknown-linux-musl --target x86_64-unknown-linux-musl + +# Copy artifacts from cargo target dir into to the artifacts directory +artifacts: rust-build + pwd + mkdir -p {{artifacts_dir}} + cp {{target_dir}}/aarch64-apple-darwin/artifact/{{package_name}} {{artifacts_dir}}/{{package_name}}-macos-aarch64 + cp {{target_dir}}/x86_64-unknown-linux-musl/artifact/{{package_name}} {{artifacts_dir}}/{{package_name}}-linux-x86_64 + cp {{target_dir}}/aarch64-unknown-linux-musl/artifact/{{package_name}} {{artifacts_dir}}/{{package_name}}-linux-aarch64 + cp {{target_dir}}/x86_64-pc-windows-gnu/artifact/{{package_name}}.exe {{artifacts_dir}}/{{package_name}}-windows-x86_64.exe + +# Build Docker image +podman: artifacts + podman build --platform linux/arm64,linux/amd64,windows/amd64 . + +# Clean artifacts +clean: + rm -rf {{artifacts_dir}} + +# Run all tasks +all: rust-build artifacts podman diff --git a/rust-toolchain.toml b/rust-toolchain.toml index d118a7e..5a18fd2 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.81.0" # See workspace Cargo.toml +channel = "1.82.0" # See workspace Cargo.toml components = ["rust-src"] profile = "default" targets = ["x86_64-pc-windows-gnu", "x86_64-unknown-linux-musl", "aarch64-unknown-linux-musl", "aarch64-apple-darwin"]