Initial commit
This commit is contained in:
commit
d6392c7751
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
/target
|
||||||
|
**/*.rs.bk
|
6
Cargo.lock
generated
Normal file
6
Cargo.lock
generated
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
[[package]]
|
||||||
|
name = "hello_world"
|
||||||
|
version = "0.1.0"
|
||||||
|
|
7
Cargo.toml
Normal file
7
Cargo.toml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[package]
|
||||||
|
name = "hello_world"
|
||||||
|
version = "1.0.0"
|
||||||
|
authors = ["Daniel Flanagan <daniel@lytedev.io>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
3
Dockerfile
Normal file
3
Dockerfile
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
FROM scratch
|
||||||
|
ADD target/x86_64-unknown-linux-musl/release/hello_world /app
|
||||||
|
ENTRYPOINT ["/app"]
|
16
makefile
Normal file
16
makefile
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
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
|
3
src/main.rs
Normal file
3
src/main.rs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
fn main() {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
Loading…
Reference in a new issue