File tree 3 files changed +18
-6
lines changed 3 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -11,3 +11,11 @@ ADD --chown=rust:rust . ./
11
11
12
12
# Build our application.
13
13
RUN cargo build
14
+
15
+ # Now, we need to build our _real_ Docker container, copying in `linking-with-git2`.
16
+ FROM debian:stretch-slim
17
+ RUN apt-get update && apt-get install -y ca-certificates
18
+ COPY --from=builder \
19
+ /home/rust/src/target/x86_64-unknown-linux-musl/debug/linking-with-git2 \
20
+ /usr/local/bin/
21
+ CMD /usr/local/bin/linking-with-git2
Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ ADD --chown=rust:rust . ./
17
17
RUN cargo build --release
18
18
19
19
# Now, we need to build our _real_ Docker container, copying in `using-sqlx`.
20
- FROM alpine:latest
21
- RUN apk --no-cache add ca-certificates
20
+ FROM debian:stretch-slim
21
+ RUN apt-get update && apt-get install -y ca-certificates
22
22
COPY --from=builder \
23
23
/home/rust/src/target/x86_64-unknown-linux-musl/release/using-sqlx \
24
24
/usr/local/bin/
Original file line number Diff line number Diff line change @@ -17,12 +17,14 @@ echo "==== Verifying static linking"
17
17
18
18
# Make sure we can build a static executable using `sqlx`.
19
19
docker build -t rust-musl-builder-using-sqlx examples/using-sqlx
20
- docker run --rm rust-musl-builder-using-sqlx sh -c "
20
+ docker run --rm rust-musl-builder-using-sqlx bash -c "
21
21
set -euo pipefail
22
22
23
23
echo -e '--- Test case for sqlx:'
24
24
echo 'ldd says:'
25
- if ldd /usr/local/bin/using-sqlx; then
25
+ lddresult=\$ (ldd /usr/local/bin/using-sqlx)
26
+ echo \$ lddresult
27
+ if [[ " \$ lddresult" != *statically\ linked* ]]; then
26
28
echo '[FAIL] Executable is not static!' 1>&2
27
29
exit 1
28
30
fi
@@ -33,14 +35,16 @@ echo -e '[PASS] using-sqlx binary is statically linked.\n'
33
35
docker build -t rust-musl-builder-linking-with-git2 examples/linking-with-git2
34
36
docker run --rm rust-musl-builder-linking-with-git2 bash -c "
35
37
set -euo pipefail
36
- cd /home/rust/src
37
38
38
39
echo -e '--- Test case for libgit2:'
39
40
echo 'ldd says:'
40
- if ldd target/x86_64-unknown-linux-musl/debug/linking-with-git2; then
41
+ lddresult=\$ (ldd /usr/local/bin/linking-with-git2)
42
+ echo \$ lddresult
43
+ if [[ " \$ lddresult" != *statically\ linked* ]]; then
41
44
echo '[FAIL] Executable is not static!' 1>&2
42
45
exit 1
43
46
fi
47
+
44
48
echo -e '[PASS] libgit2 binary is statically linked.\n'
45
49
"
46
50
You can’t perform that action at this time.
0 commit comments