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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This file is automatically @generated by Cargo.
|
2 |
+
# It is not intended for manual editing.
|
3 |
+
version = 4
|
4 |
+
|
5 |
+
[[package]]
|
6 |
+
name = "anstream"
|
7 |
+
version = "0.6.18"
|
8 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
9 |
+
checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b"
|
10 |
+
dependencies = [
|
11 |
+
"anstyle",
|
12 |
+
"anstyle-parse",
|
13 |
+
"anstyle-query",
|
14 |
+
"anstyle-wincon",
|
15 |
+
"colorchoice",
|
16 |
+
"is_terminal_polyfill",
|
17 |
+
"utf8parse",
|
18 |
+
]
|
19 |
+
|
20 |
+
[[package]]
|
21 |
+
name = "anstyle"
|
22 |
+
version = "1.0.10"
|
23 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
24 |
+
checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9"
|
25 |
+
|
26 |
+
[[package]]
|
27 |
+
name = "anstyle-parse"
|
28 |
+
version = "0.2.6"
|
29 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
30 |
+
checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9"
|
31 |
+
dependencies = [
|
32 |
+
"utf8parse",
|
33 |
+
]
|
34 |
+
|
35 |
+
[[package]]
|
36 |
+
name = "anstyle-query"
|
37 |
+
version = "1.1.2"
|
38 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
39 |
+
checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c"
|
40 |
+
dependencies = [
|
41 |
+
"windows-sys",
|
42 |
+
]
|
43 |
+
|
44 |
+
[[package]]
|
45 |
+
name = "anstyle-wincon"
|
46 |
+
version = "3.0.6"
|
47 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
48 |
+
checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125"
|
49 |
+
dependencies = [
|
50 |
+
"anstyle",
|
51 |
+
"windows-sys",
|
52 |
+
]
|
53 |
+
|
54 |
+
[[package]]
|
55 |
+
name = "clap"
|
56 |
+
version = "4.5.24"
|
57 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
58 |
+
checksum = "9560b07a799281c7e0958b9296854d6fafd4c5f31444a7e5bb1ad6dde5ccf1bd"
|
59 |
+
dependencies = [
|
60 |
+
"clap_builder",
|
61 |
+
"clap_derive",
|
62 |
+
]
|
63 |
+
|
64 |
+
[[package]]
|
65 |
+
name = "clap_builder"
|
66 |
+
version = "4.5.24"
|
67 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
68 |
+
checksum = "874e0dd3eb68bf99058751ac9712f622e61e6f393a94f7128fa26e3f02f5c7cd"
|
69 |
+
dependencies = [
|
70 |
+
"anstream",
|
71 |
+
"anstyle",
|
72 |
+
"clap_lex",
|
73 |
+
"strsim",
|
74 |
+
]
|
75 |
+
|
76 |
+
[[package]]
|
77 |
+
name = "clap_derive"
|
78 |
+
version = "4.5.24"
|
79 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
80 |
+
checksum = "54b755194d6389280185988721fffba69495eed5ee9feeee9a599b53db80318c"
|
81 |
+
dependencies = [
|
82 |
+
"heck",
|
83 |
+
"proc-macro2",
|
84 |
+
"quote",
|
85 |
+
"syn",
|
86 |
+
]
|
87 |
+
|
88 |
+
[[package]]
|
89 |
+
name = "clap_lex"
|
90 |
+
version = "0.7.4"
|
91 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
92 |
+
checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
|
93 |
+
|
94 |
+
[[package]]
|
95 |
+
name = "colorchoice"
|
96 |
+
version = "1.0.3"
|
97 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
98 |
+
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
|
99 |
+
|
100 |
+
[[package]]
|
101 |
+
name = "heck"
|
102 |
+
version = "0.5.0"
|
103 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
104 |
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
105 |
+
|
106 |
+
[[package]]
|
107 |
+
name = "hello-world"
|
108 |
+
version = "0.1.0"
|
109 |
+
dependencies = [
|
110 |
+
"clap",
|
111 |
+
]
|
112 |
+
|
113 |
+
[[package]]
|
114 |
+
name = "is_terminal_polyfill"
|
115 |
+
version = "1.70.1"
|
116 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
117 |
+
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
118 |
+
|
119 |
+
[[package]]
|
120 |
+
name = "proc-macro2"
|
121 |
+
version = "1.0.92"
|
122 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
123 |
+
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
|
124 |
+
dependencies = [
|
125 |
+
"unicode-ident",
|
126 |
+
]
|
127 |
+
|
128 |
+
[[package]]
|
129 |
+
name = "quote"
|
130 |
+
version = "1.0.38"
|
131 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
132 |
+
checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
|
133 |
+
dependencies = [
|
134 |
+
"proc-macro2",
|
135 |
+
]
|
136 |
+
|
137 |
+
[[package]]
|
138 |
+
name = "strsim"
|
139 |
+
version = "0.11.1"
|
140 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
141 |
+
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
142 |
+
|
143 |
+
[[package]]
|
144 |
+
name = "syn"
|
145 |
+
version = "2.0.95"
|
146 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
147 |
+
checksum = "46f71c0377baf4ef1cc3e3402ded576dccc315800fbc62dfc7fe04b009773b4a"
|
148 |
+
dependencies = [
|
149 |
+
"proc-macro2",
|
150 |
+
"quote",
|
151 |
+
"unicode-ident",
|
152 |
+
]
|
153 |
+
|
154 |
+
[[package]]
|
155 |
+
name = "unicode-ident"
|
156 |
+
version = "1.0.14"
|
157 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
158 |
+
checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
|
159 |
+
|
160 |
+
[[package]]
|
161 |
+
name = "utf8parse"
|
162 |
+
version = "0.2.2"
|
163 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
164 |
+
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
165 |
+
|
166 |
+
[[package]]
|
167 |
+
name = "windows-sys"
|
168 |
+
version = "0.59.0"
|
169 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
170 |
+
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
171 |
+
dependencies = [
|
172 |
+
"windows-targets",
|
173 |
+
]
|
174 |
+
|
175 |
+
[[package]]
|
176 |
+
name = "windows-targets"
|
177 |
+
version = "0.52.6"
|
178 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
179 |
+
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
180 |
+
dependencies = [
|
181 |
+
"windows_aarch64_gnullvm",
|
182 |
+
"windows_aarch64_msvc",
|
183 |
+
"windows_i686_gnu",
|
184 |
+
"windows_i686_gnullvm",
|
185 |
+
"windows_i686_msvc",
|
186 |
+
"windows_x86_64_gnu",
|
187 |
+
"windows_x86_64_gnullvm",
|
188 |
+
"windows_x86_64_msvc",
|
189 |
+
]
|
190 |
+
|
191 |
+
[[package]]
|
192 |
+
name = "windows_aarch64_gnullvm"
|
193 |
+
version = "0.52.6"
|
194 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
195 |
+
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
196 |
+
|
197 |
+
[[package]]
|
198 |
+
name = "windows_aarch64_msvc"
|
199 |
+
version = "0.52.6"
|
200 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
201 |
+
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
202 |
+
|
203 |
+
[[package]]
|
204 |
+
name = "windows_i686_gnu"
|
205 |
+
version = "0.52.6"
|
206 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
207 |
+
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
208 |
+
|
209 |
+
[[package]]
|
210 |
+
name = "windows_i686_gnullvm"
|
211 |
+
version = "0.52.6"
|
212 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
213 |
+
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
214 |
+
|
215 |
+
[[package]]
|
216 |
+
name = "windows_i686_msvc"
|
217 |
+
version = "0.52.6"
|
218 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
219 |
+
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
220 |
+
|
221 |
+
[[package]]
|
222 |
+
name = "windows_x86_64_gnu"
|
223 |
+
version = "0.52.6"
|
224 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
225 |
+
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
226 |
+
|
227 |
+
[[package]]
|
228 |
+
name = "windows_x86_64_gnullvm"
|
229 |
+
version = "0.52.6"
|
230 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
231 |
+
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
232 |
+
|
233 |
+
[[package]]
|
234 |
+
name = "windows_x86_64_msvc"
|
235 |
+
version = "0.52.6"
|
236 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
237 |
+
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
Cargo.toml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[package]
|
2 |
+
name = "hello-world"
|
3 |
+
version = "0.1.0"
|
4 |
+
edition = "2021"
|
5 |
+
|
6 |
+
[[bin]]
|
7 |
+
name = "help"
|
8 |
+
path = "src/help.rs"
|
9 |
+
|
10 |
+
[dependencies]
|
11 |
+
clap = { version = "4", features = ["derive"] }
|
Dockerfile
CHANGED
@@ -1,3 +1,13 @@
|
|
1 |
-
FROM
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM rust:1.83.0 AS builder
|
2 |
|
3 |
+
WORKDIR /app
|
4 |
+
COPY . .
|
5 |
+
RUN cargo install --path .
|
6 |
+
CMD ["hello-world"]
|
7 |
+
|
8 |
+
FROM debian:buster-slim
|
9 |
+
RUN apt-get update & apt-get install -y extra-runtime-dependencies & rm -rf /var/lib/apt/lists/*
|
10 |
+
COPY --from=builder /usr/local/cargo/bin/hello-world /usr/local/bin/hello-world
|
11 |
+
COPY --from=builder /usr/local/cargo/bin/help /usr/local/bin/help
|
12 |
+
|
13 |
+
CMD ["hello-world"]
|
src/help.rs
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
fn main() {
|
2 |
+
println!("You just ran the help bin!");
|
3 |
+
}
|
src/main.rs
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
use clap::Parser;
|
2 |
+
use std::{env, thread, time::Duration};
|
3 |
+
|
4 |
+
#[derive(Debug, Parser)]
|
5 |
+
#[command(author, version, about, long_about = None)]
|
6 |
+
struct Args {
|
7 |
+
#[arg(long, short)]
|
8 |
+
message: String,
|
9 |
+
|
10 |
+
#[arg(long, short, default_value_t = 10)]
|
11 |
+
wait: u8,
|
12 |
+
}
|
13 |
+
|
14 |
+
fn main() {
|
15 |
+
let Args { message, wait } = Args::parse();
|
16 |
+
|
17 |
+
let name = env::var("MY_NAME").unwrap_or(String::from("world"));
|
18 |
+
|
19 |
+
println!("Hello, {name}!");
|
20 |
+
println!("Message: {message}");
|
21 |
+
println!("Will wait for {wait} seconds");
|
22 |
+
|
23 |
+
thread::sleep(Duration::from_secs(wait as u64));
|
24 |
+
}
|