rust-static-binary-example/makefile
2020-02-07 10:11:23 -06:00

17 lines
457 B
Makefile

TARGET := x86_64-unknown-linux-musl
BUILD_DIR := target/${TARGET}/release
BIN_NAME := hello_world
.PHONY: build docker-image
build: ${BUILD_DIR}/${BIN_NAME}
${BUILD_DIR}/${BIN_NAME}:
cargo build --target ${TARGET} --release; strip ${BUILD_DIR}/${BIN_NAME}; upx ${BUILD_DIR}/${BIN_NAME}
docker-image: ${BUILD_DIR}/${BIN_NAME}
docker build -t hello_world_rust_static_binary:1.0.0 .
docker-run:
docker run -it --rm hello_world_rust_static_binary:1.0.0