Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make a Dockerfile with a very slim output image #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
FROM clux/muslrust
FROM clux/muslrust as builder

RUN rustup update stable \
&& rustup default stable \
&& rustup target add x86_64-unknown-linux-musl \
&& cargo install cargo-deb tomato-toml

COPY entrypoint.sh /entrypoint.sh
FROM alpine:3.16 as runner

COPY --from=builder /root/.cargo/bin/cargo-deb /cargo-deb
COPY --from=builder /root/.cargo/bin/tomato /tomato
COPY /entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
4 changes: 3 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ else
VERSION=$(echo "$GITHUB_REF" | sed 's|refs/tags/||')
fi

tomato set package.version "$VERSION" "$INPUT_TOML_PATH/Cargo.toml"
PATH=$PATH:/

./tomato set package.version "$VERSION" "$INPUT_TOML_PATH/Cargo.toml"

# Taken from https://github.com/zhxiaogg/cargo-static-build, unsure if all needed or not

Expand Down