Run update.sh

This commit is contained in:
Docker Library Bot 2019-12-27 21:11:55 +00:00
parent 0cc7ca93ec
commit c527715c54
1 changed files with 20 additions and 0 deletions

View File

@ -79,6 +79,26 @@ $ docker build -t my-rust-app .
$ docker run -it --rm --name my-running-app my-rust-app
```
This creates an image that has all of the rust tooling for the image, which is 1.8gb. If you just want the compiled application:
```dockerfile
FROM rust:1.39 as builder
WORKDIR /usr/src/myapp
COPY . .
RUN cargo install --path .
FROM debian:buster-slim
RUN apt-get update && apt-get install -y libssl
COPY --from=builder /usr/src/myapp /usr/local/bin/myapp
CMD ["myapp"]
```
Note: Some shared libraries may need to be installed as shown in the installation of the libssl line above.
This method will create an image that is less than 200mb. If you switch to using the Alpine-based rust image, you might be able to save another 60mb.
See https://docs.docker.com/develop/develop-images/multistage-build/ for more information.
## Compile your app inside the Docker container
There may be occasions where it is not appropriate to run your app inside a container. To compile, but not run your app inside the Docker instance, you can write something like: