Debian Codegraph @

src/lib.rs

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
•1 #![cfg_attr(feature="docinclude", doc = include_str!("../README.md"))]
2
3 mod builderrust-analyzer cargo dockerfile 0.2.1 builder/;
4 mod instructionsrust-analyzer cargo dockerfile 0.2.1 instructions/;
5
6 pub use craterust-analyzer cargo dockerfile 0.2.1 crate/::{
7 builderrust-analyzer cargo dockerfile 0.2.1 builder/::{
8 Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#,
9 DockerfileBuilderrust-analyzer cargo dockerfile 0.2.1 builder/DockerfileBuilder#,
10 },
11 instructionsrust-analyzer cargo dockerfile 0.2.1 instructions/::{
12 Addrust-analyzer cargo dockerfile 0.2.1 instructions/Add#,
13 Argrust-analyzer cargo dockerfile 0.2.1 instructions/Arg#,
14 Cmdrust-analyzer cargo dockerfile 0.2.1 instructions/Cmd#,
15 Copyrust-analyzer cargo dockerfile 0.2.1 instructions/Copy#,
16 Directiverust-analyzer cargo dockerfile 0.2.1 instructions/Directive#,
17 Entrypointrust-analyzer cargo dockerfile 0.2.1 instructions/Entrypoint#,
18 Envrust-analyzer cargo dockerfile 0.2.1 instructions/Env#,
19 Exposerust-analyzer cargo dockerfile 0.2.1 instructions/Expose#,
20 Fromrust-analyzer cargo dockerfile 0.2.1 instructions/From#,
21 Healthcheckrust-analyzer cargo dockerfile 0.2.1 instructions/Healthcheck#,
22 Labelrust-analyzer cargo dockerfile 0.2.1 instructions/Label#,
23 Onbuildrust-analyzer cargo dockerfile 0.2.1 instructions/Onbuild#,
24 Runrust-analyzer cargo dockerfile 0.2.1 instructions/Run#,
25 Shellrust-analyzer cargo dockerfile 0.2.1 instructions/Shell#,
26 Stopsignalrust-analyzer cargo dockerfile 0.2.1 instructions/Stopsignal#,
27 Userrust-analyzer cargo dockerfile 0.2.1 instructions/User#,
28 Volumerust-analyzer cargo dockerfile 0.2.1 instructions/Volume#,
29 Workdirrust-analyzer cargo dockerfile 0.2.1 instructions/Workdir#,
30 Instructionrust-analyzer cargo dockerfile 0.2.1 instructions/Instruction#,
31 },
32 };
33
34 //////////////////////////////////////////////////////////////////////////////////////////////////
35 // Unit Tests ////////////////////////////////////////////////////////////////////////////////////
36
37 #[cfg(test)]
38 mod testrust-analyzer cargo dockerfile 0.2.1 test/ {
39 use superrust-analyzer cargo dockerfile 0.2.1 crate/::*;
40
41 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
42 fn dockerfile_generation_simplerust-analyzer cargo dockerfile 0.2.1 test/dockerfile_generation_simple().() {
43 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#::baserust-analyzer cargo dockerfile 0.2.1 builder/impl#[Dockerfile]base().("rust:1.30-slim")
44 .finishrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]finish().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
45 r##"FROM rust:1.30-slim
46 "##)
47 }
48
49 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
50 fn dockerfile_generation_with_directives_and_argsrust-analyzer cargo dockerfile 0.2.1 test/dockerfile_generation_with_directives_and_args().() {
51 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#::baserust-analyzer cargo dockerfile 0.2.1 builder/impl#[Dockerfile]base().("rust:1.30-slim")
52 .push_initial_directiverust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push_initial_directive().(Directiverust-analyzer cargo dockerfile 0.2.1 instructions/Directive#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Directive]new().("escape=`"))
53 .push_initial_argrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push_initial_arg().(Argrust-analyzer cargo dockerfile 0.2.1 instructions/Arg#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Arg]new().("TEST"))
54 .push_initial_argrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push_initial_arg().(Argrust-analyzer cargo dockerfile 0.2.1 instructions/Arg#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Arg]new().("OTHER=1"))
55 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Copyrust-analyzer cargo dockerfile 0.2.1 instructions/Copy#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Copy]new().("/static ./static".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()))
56 .finishrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]finish().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
57 r##"# escape=`
58 ARG TEST
59 ARG OTHER=1
60 FROM rust:1.30-slim
61 COPY /static ./static
62 "##)
63 }
64
65 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
66 fn dockerfile_readme_examplerust-analyzer cargo dockerfile 0.2.1 test/dockerfile_readme_example().() {
67 // Build up a new Dockerfile.
68 let dockerfile = Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#::baserust-analyzer cargo dockerfile 0.2.1 builder/impl#[Dockerfile]base().("rust:${RUST_VERSION}-slim")
69 .push_initial_argrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push_initial_arg().(Argrust-analyzer cargo dockerfile 0.2.1 instructions/Arg#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Arg]new().("RUST_VERSION=1.31"))
70 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Copyrust-analyzer cargo dockerfile 0.2.1 instructions/Copy#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Copy]new().("/static ./static"))
71 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Cmdrust-analyzer cargo dockerfile 0.2.1 instructions/Cmd#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Cmd]new().("echo 'Hello. Goodbye.'"))
72 .finishrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]finish().();
73
74 // Write it out as a string.
75 let output = dockerfile.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().();
76 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(output,
77 r##"ARG RUST_VERSION=1.31
78 FROM rust:${RUST_VERSION}-slim
79 COPY /static ./static
80 CMD echo 'Hello. Goodbye.'
81 "##)
82 }
83
84 //////////////////////////////////////////////////////////////////////////////////////////////
85 // Exhaustive Tests //////////////////////////////////////////////////////////////////////////
86 //
87 // The tests here are intended to test each of the different instruction types in relative
88 // isolation.
89
90 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
91 fn dockerfile_with_addrust-analyzer cargo dockerfile 0.2.1 test/dockerfile_with_add().() {
92 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#::baserust-analyzer cargo dockerfile 0.2.1 builder/impl#[Dockerfile]base().("rust:1.31-slim")
93 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Addrust-analyzer cargo dockerfile 0.2.1 instructions/Add#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Add]new().("/file ./file"))
94 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Cmdrust-analyzer cargo dockerfile 0.2.1 instructions/Cmd#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Cmd]new().("echo 'Hello, world.'"))
95 .finishrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]finish().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
96 r##"FROM rust:1.31-slim
97 ADD /file ./file
98 CMD echo 'Hello, world.'
99 "##)
100 }
101
102 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
103 fn dockerfile_with_argrust-analyzer cargo dockerfile 0.2.1 test/dockerfile_with_arg().() {
104 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#::baserust-analyzer cargo dockerfile 0.2.1 builder/impl#[Dockerfile]base().("rust:1.31-slim")
105 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Argrust-analyzer cargo dockerfile 0.2.1 instructions/Arg#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Arg]new().("VAL=testing"))
106 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Cmdrust-analyzer cargo dockerfile 0.2.1 instructions/Cmd#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Cmd]new().("echo 'Hello, world.'"))
107 .finishrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]finish().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
108 r##"FROM rust:1.31-slim
109 ARG VAL=testing
110 CMD echo 'Hello, world.'
111 "##)
112 }
113
114 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
115 fn dockerfile_with_cmdrust-analyzer cargo dockerfile 0.2.1 test/dockerfile_with_cmd().() {
116 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#::baserust-analyzer cargo dockerfile 0.2.1 builder/impl#[Dockerfile]base().("rust:1.31-slim")
117 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Cmdrust-analyzer cargo dockerfile 0.2.1 instructions/Cmd#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Cmd]new().("echo 'Hello, world.'"))
118 .finishrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]finish().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
119 r##"FROM rust:1.31-slim
120 CMD echo 'Hello, world.'
121 "##)
122 }
123
124 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
125 fn dockerfile_with_copyrust-analyzer cargo dockerfile 0.2.1 test/dockerfile_with_copy().() {
126 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#::baserust-analyzer cargo dockerfile 0.2.1 builder/impl#[Dockerfile]base().("rust:1.31-slim")
127 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Copyrust-analyzer cargo dockerfile 0.2.1 instructions/Copy#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Copy]new().("/static ./static"))
128 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Cmdrust-analyzer cargo dockerfile 0.2.1 instructions/Cmd#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Cmd]new().("echo 'Hello, world.'"))
129 .finishrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]finish().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
130 r##"FROM rust:1.31-slim
131 COPY /static ./static
132 CMD echo 'Hello, world.'
133 "##)
134 }
135
136 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
137 fn dockerfile_with_directiverust-analyzer cargo dockerfile 0.2.1 test/dockerfile_with_directive().() {
138 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#::baserust-analyzer cargo dockerfile 0.2.1 builder/impl#[Dockerfile]base().("rust:1.31-slim")
139 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Directiverust-analyzer cargo dockerfile 0.2.1 instructions/Directive#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Directive]new().("escape=`"))
140 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Cmdrust-analyzer cargo dockerfile 0.2.1 instructions/Cmd#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Cmd]new().("echo 'Hello, world.'"))
141 .finishrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]finish().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
142 r##"FROM rust:1.31-slim
143 # escape=`
144 CMD echo 'Hello, world.'
145 "##)
146 }
147
148 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
149 fn dockerfile_with_entrypointrust-analyzer cargo dockerfile 0.2.1 test/dockerfile_with_entrypoint().() {
150 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#::baserust-analyzer cargo dockerfile 0.2.1 builder/impl#[Dockerfile]base().("rust:1.31-slim")
151 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Entrypointrust-analyzer cargo dockerfile 0.2.1 instructions/Entrypoint#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Entrypoint]new().("echo"))
152 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Cmdrust-analyzer cargo dockerfile 0.2.1 instructions/Cmd#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Cmd]new().("'Hello, world.'"))
153 .finishrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]finish().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
154 r##"FROM rust:1.31-slim
155 ENTRYPOINT echo
156 CMD 'Hello, world.'
157 "##)
158 }
159
160 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
161 fn dockerfile_with_envrust-analyzer cargo dockerfile 0.2.1 test/dockerfile_with_env().() {
162 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#::baserust-analyzer cargo dockerfile 0.2.1 builder/impl#[Dockerfile]base().("rust:1.31-slim")
163 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Envrust-analyzer cargo dockerfile 0.2.1 instructions/Env#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Env]new().("VAL=test"))
164 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Cmdrust-analyzer cargo dockerfile 0.2.1 instructions/Cmd#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Cmd]new().("echo 'Hello, world.'"))
165 .finishrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]finish().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
166 r##"FROM rust:1.31-slim
167 ENV VAL=test
168 CMD echo 'Hello, world.'
169 "##)
170 }
171
172 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
173 fn dockerfile_with_exposerust-analyzer cargo dockerfile 0.2.1 test/dockerfile_with_expose().() {
174 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#::baserust-analyzer cargo dockerfile 0.2.1 builder/impl#[Dockerfile]base().("rust:1.31-slim")
175 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Exposerust-analyzer cargo dockerfile 0.2.1 instructions/Expose#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Expose]new().("80"))
176 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Cmdrust-analyzer cargo dockerfile 0.2.1 instructions/Cmd#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Cmd]new().("echo 'Hello, world.'"))
177 .finishrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]finish().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
178 r##"FROM rust:1.31-slim
179 EXPOSE 80
180 CMD echo 'Hello, world.'
181 "##)
182 }
183
184 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
185 fn dockerfile_with_fromrust-analyzer cargo dockerfile 0.2.1 test/dockerfile_with_from().() {
186 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#::baserust-analyzer cargo dockerfile 0.2.1 builder/impl#[Dockerfile]base().("rust:1.31-slim")
187 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Fromrust-analyzer cargo dockerfile 0.2.1 instructions/From#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[From]new().("rust:1.31-slim as other"))
188 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Cmdrust-analyzer cargo dockerfile 0.2.1 instructions/Cmd#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Cmd]new().("echo 'Hello, world.'"))
189 .finishrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]finish().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
190 r##"FROM rust:1.31-slim
191 FROM rust:1.31-slim as other
192 CMD echo 'Hello, world.'
193 "##)
194 }
195
196 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
197 fn dockerfile_with_healthcheckrust-analyzer cargo dockerfile 0.2.1 test/dockerfile_with_healthcheck().() {
198 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#::baserust-analyzer cargo dockerfile 0.2.1 builder/impl#[Dockerfile]base().("rust:1.31-slim")
199 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Healthcheckrust-analyzer cargo dockerfile 0.2.1 instructions/Healthcheck#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Healthcheck]new().("CMD pgrep 1"))
200 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Cmdrust-analyzer cargo dockerfile 0.2.1 instructions/Cmd#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Cmd]new().("echo 'Hello, world.'"))
201 .finishrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]finish().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
202 r##"FROM rust:1.31-slim
203 HEALTHCHECK CMD pgrep 1
204 CMD echo 'Hello, world.'
205 "##)
206 }
207
208 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
209 fn dockerfile_with_labelrust-analyzer cargo dockerfile 0.2.1 test/dockerfile_with_label().() {
210 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#::baserust-analyzer cargo dockerfile 0.2.1 builder/impl#[Dockerfile]base().("rust:1.31-slim")
211 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Labelrust-analyzer cargo dockerfile 0.2.1 instructions/Label#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Label]new().("maintainer='Anthony J Dodd'"))
212 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Cmdrust-analyzer cargo dockerfile 0.2.1 instructions/Cmd#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Cmd]new().("echo 'Hello, world.'"))
213 .finishrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]finish().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
214 r##"FROM rust:1.31-slim
215 LABEL maintainer='Anthony J Dodd'
216 CMD echo 'Hello, world.'
217 "##)
218 }
219
220 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
221 fn dockerfile_with_onbuildrust-analyzer cargo dockerfile 0.2.1 test/dockerfile_with_onbuild().() {
222 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#::baserust-analyzer cargo dockerfile 0.2.1 builder/impl#[Dockerfile]base().("rust:1.31-slim")
223 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Onbuildrust-analyzer cargo dockerfile 0.2.1 instructions/Onbuild#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Onbuild]new().("RUN echo 'ehlo'"))
224 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Cmdrust-analyzer cargo dockerfile 0.2.1 instructions/Cmd#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Cmd]new().("echo 'Hello, world.'"))
225 .finishrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]finish().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
226 r##"FROM rust:1.31-slim
227 ONBUILD RUN echo 'ehlo'
228 CMD echo 'Hello, world.'
229 "##)
230 }
231
232 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
233 fn dockerfile_with_runrust-analyzer cargo dockerfile 0.2.1 test/dockerfile_with_run().() {
234 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#::baserust-analyzer cargo dockerfile 0.2.1 builder/impl#[Dockerfile]base().("rust:1.31-slim")
235 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Runrust-analyzer cargo dockerfile 0.2.1 instructions/Run#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Run]new().("apt-get update -yy"))
236 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Cmdrust-analyzer cargo dockerfile 0.2.1 instructions/Cmd#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Cmd]new().("echo 'Hello, world.'"))
237 .finishrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]finish().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
238 r##"FROM rust:1.31-slim
239 RUN apt-get update -yy
240 CMD echo 'Hello, world.'
241 "##)
242 }
243
244 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
245 fn dockerfile_with_shellrust-analyzer cargo dockerfile 0.2.1 test/dockerfile_with_shell().() {
246 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#::baserust-analyzer cargo dockerfile 0.2.1 builder/impl#[Dockerfile]base().("rust:1.31-slim")
247 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Shellrust-analyzer cargo dockerfile 0.2.1 instructions/Shell#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Shell]new().(r#"["/bin/sh", "-c"]"#))
248 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Cmdrust-analyzer cargo dockerfile 0.2.1 instructions/Cmd#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Cmd]new().("echo 'Hello, world.'"))
249 .finishrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]finish().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
250 r##"FROM rust:1.31-slim
251 SHELL ["/bin/sh", "-c"]
252 CMD echo 'Hello, world.'
253 "##)
254 }
255
256 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
257 fn dockerfile_with_stopsignalrust-analyzer cargo dockerfile 0.2.1 test/dockerfile_with_stopsignal().() {
258 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#::baserust-analyzer cargo dockerfile 0.2.1 builder/impl#[Dockerfile]base().("rust:1.31-slim")
259 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Stopsignalrust-analyzer cargo dockerfile 0.2.1 instructions/Stopsignal#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Stopsignal]new().("SIGKILL"))
260 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Cmdrust-analyzer cargo dockerfile 0.2.1 instructions/Cmd#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Cmd]new().("echo 'Hello, world.'"))
261 .finishrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]finish().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
262 r##"FROM rust:1.31-slim
263 STOPSIGNAL SIGKILL
264 CMD echo 'Hello, world.'
265 "##)
266 }
267
268 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
269 fn dockerfile_with_userrust-analyzer cargo dockerfile 0.2.1 test/dockerfile_with_user().() {
270 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#::baserust-analyzer cargo dockerfile 0.2.1 builder/impl#[Dockerfile]base().("rust:1.31-slim")
271 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Userrust-analyzer cargo dockerfile 0.2.1 instructions/User#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[User]new().("root"))
272 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Cmdrust-analyzer cargo dockerfile 0.2.1 instructions/Cmd#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Cmd]new().("echo 'Hello, world.'"))
273 .finishrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]finish().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
274 r##"FROM rust:1.31-slim
275 USER root
276 CMD echo 'Hello, world.'
277 "##)
278 }
279
280 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
281 fn dockerfile_with_volumerust-analyzer cargo dockerfile 0.2.1 test/dockerfile_with_volume().() {
282 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#::baserust-analyzer cargo dockerfile 0.2.1 builder/impl#[Dockerfile]base().("rust:1.31-slim")
283 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Volumerust-analyzer cargo dockerfile 0.2.1 instructions/Volume#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Volume]new().(r#"["/data"]"#))
284 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Cmdrust-analyzer cargo dockerfile 0.2.1 instructions/Cmd#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Cmd]new().("echo 'Hello, world.'"))
285 .finishrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]finish().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
286 r##"FROM rust:1.31-slim
287 VOLUME ["/data"]
288 CMD echo 'Hello, world.'
289 "##)
290 }
291
292 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
293 fn dockerfile_with_workdirrust-analyzer cargo dockerfile 0.2.1 test/dockerfile_with_workdir().() {
294 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Dockerfilerust-analyzer cargo dockerfile 0.2.1 builder/Dockerfile#::baserust-analyzer cargo dockerfile 0.2.1 builder/impl#[Dockerfile]base().("rust:1.31-slim")
295 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Workdirrust-analyzer cargo dockerfile 0.2.1 instructions/Workdir#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Workdir]new().("/app"))
296 .pushrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]push().(Cmdrust-analyzer cargo dockerfile 0.2.1 instructions/Cmd#::newrust-analyzer cargo dockerfile 0.2.1 instructions/impl#[Cmd]new().("echo 'Hello, world.'"))
297 .finishrust-analyzer cargo dockerfile 0.2.1 builder/impl#[DockerfileBuilder]finish().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
298 r##"FROM rust:1.31-slim
299 WORKDIR /app
300 CMD echo 'Hello, world.'
301 "##)
302 }
303 }