←back to thread

303 points Bogdanp | 1 comments | | HN request time: 0.28s | source
Show context
duped ◴[] No.44391878[source]
A lot of people are replying to the title instead of the article.

> To get your Rust program in a container, the typical approach you might find would be something like:

If you have `cargo build --target x86_64-unknown-linux-musl` in your build process you do not need to do this anywhere in your Dockerfile. You should compile and copy into /sbin or something.

If you really want to build in a docker image I would suggest using `cargo --target-dir=/target ...` and then run with `docker run --mount type-bind,...` and then copy out of the bind mount into /bin or wherever.

replies(2): >>44392969 #>>44397078 #
1. remram ◴[] No.44397078[source]
The author dismissed that option saying "I value that docker build can have a clean environment every time", so this is self-inflicted.