Skip to content

Commit 0598383

Browse files
authored
Merge pull request #5 from dimacurrentai/generic_run
Generic run
2 parents 4263659 + 8180527 commit 0598383

File tree

11 files changed

+13
-99
lines changed

11 files changed

+13
-99
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
Cargo.lock
22
target/
3+
4+
# Using the `Dockerfile.template` in the root directory now.
5+
Dockerfile
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ FROM alpine AS build
55
RUN 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
99
RUN mv /root/.cargo/bin/* /usr/local/bin/
1010

1111
# Build the project.
1212
COPY ./code /code
1313
WORKDIR /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.
2020
FROM scratch
21-
COPY --from=build /hw /hw
22-
ENTRYPOINT ["/hw"]
21+
COPY --from=build /binary /binary
22+
ENTRYPOINT ["/binary"]

step00_hw/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
set -e
44

5-
docker build . -t demo
5+
docker build -f ../Dockerfile.template . -t demo
66
docker run --rm -t demo

step01_cmdline/Dockerfile

Lines changed: 0 additions & 22 deletions
This file was deleted.

step01_cmdline/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
set -e
44

5-
docker build . -t demo
5+
docker build -f ../Dockerfile.template . -t demo
66
docker run --rm -t demo --a 1 --b 2
77
docker run --rm -t demo --a 3 --b 4

step02_httpserver/Dockerfile

Lines changed: 0 additions & 23 deletions
This file was deleted.

step02_httpserver/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -e
44

5-
docker build . -t demo
5+
docker build -f ../Dockerfile.template . -t demo
66

77
docker run --rm --network=bridge -p 3000:3000 -t demo &
88
PID=$!

step03_mermaid/Dockerfile

Lines changed: 0 additions & 22 deletions
This file was deleted.

step03_mermaid/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -e
44

5-
docker build . -t demo
5+
docker build -f ../Dockerfile.template . -t demo
66

77
echo '```mermaid' >.mermaid.md
88
docker run --rm -t demo | tee >>.mermaid.md

step04_pest/Dockerfile

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)