Skip to content

Commit

Permalink
chore: introduce justfile for building locally (#16)
Browse files Browse the repository at this point in the history
introduce justfile for building locally
  • Loading branch information
TheButlah authored Nov 15, 2024
1 parent 5439a4e commit 5e6c1aa
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/.idea
/.vscode
/target
/artifacts
**/artifacts
.intentionally-empty-file.o

*.swp
Expand Down
34 changes: 34 additions & 0 deletions identity-server/justfile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5e6c1aa

Please sign in to comment.