File tree Expand file tree Collapse file tree 11 files changed +13
-99
lines changed
Expand file tree Collapse file tree 11 files changed +13
-99
lines changed Original file line number Diff line number Diff line change 11Cargo.lock
22target /
3+
4+ # Using the `Dockerfile.template` in the root directory now.
5+ Dockerfile
Original file line number Diff line number Diff line change @@ -5,18 +5,18 @@ FROM alpine AS build
55RUN apk add rustup clang musl
66
77# Init local rust via `rustup`, including static targets builder.
8- RUN rustup-init -y -t x86_64- unknown-linux-musl --no-modify-path
8+ RUN rustup-init -y -t "$(uname -m)- unknown-linux-musl" --no-modify-path
99RUN mv /root/.cargo/bin/* /usr/local/bin/
1010
1111# Build the project.
1212COPY ./code /code
1313WORKDIR /code
14- RUN cargo build --release --target x86_64- unknown-linux-musl
14+ RUN cargo build --release --target "$(uname -m)- unknown-linux-musl"
1515
1616# Prepare the static binary.
17- RUN cp ./target/x86_64- unknown-linux-musl/release/hw /
17+ RUN cp ./target/"$(uname -m)- unknown-linux-musl" /release/"$(cat Cargo.toml | grep '^name\s*=' | cut -f2 -d'"')" /binary
1818
1919# The resulting container with the static binary only.
2020FROM scratch
21- COPY --from=build /hw /hw
22- ENTRYPOINT ["/hw " ]
21+ COPY --from=build /binary /binary
22+ ENTRYPOINT ["/binary "]
Original file line number Diff line number Diff line change 22
33set -e
44
5- docker build . -t demo
5+ docker build -f ../Dockerfile.template . -t demo
66docker run --rm -t demo
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 22
33set -e
44
5- docker build . -t demo
5+ docker build -f ../Dockerfile.template . -t demo
66docker run --rm -t demo --a 1 --b 2
77docker run --rm -t demo --a 3 --b 4
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 22
33set -e
44
5- docker build . -t demo
5+ docker build -f ../Dockerfile.template . -t demo
66
77docker run --rm --network=bridge -p 3000:3000 -t demo &
88PID=$!
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 22
33set -e
44
5- docker build . -t demo
5+ docker build -f ../Dockerfile.template . -t demo
66
77echo ' ```mermaid' > .mermaid.md
88docker run --rm -t demo | tee >> .mermaid.md
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments