Initial commit

This commit is contained in:
Daniel Flanagan 2020-02-07 10:11:23 -06:00
commit d6392c7751
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
6 changed files with 37 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/target
**/*.rs.bk

6
Cargo.lock generated Normal file
View 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
View 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
View file

@ -0,0 +1,3 @@
FROM scratch
ADD target/x86_64-unknown-linux-musl/release/hello_world /app
ENTRYPOINT ["/app"]

16
makefile Normal file
View 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
View file

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}