nix-rust-docker-xmas-gift
Tags:
Nix-shell
If someone don’t care about a specific rust version.
{ pkgs ? import <nixpkgs> {} }:
let
cargo = pkgs.cargo;
rustc = pkgs.rustc;
rustup = pkgs.rustup;
openssl = pkgs.openssl;
in
pkgs.mkShell {
buildInputs = [
cargo
rustc
openssl
rustup
];
Docker
Pick the version you received via nix and build the app in a Dockerfile and deploy it.
FROM rust:1.XX as builder
WORKDIR /usr/src/app
COPY . .
RUN rustup target add x86_64-unknown-linux-musl
RUN apt-get update
RUN apt-get install -y cmake musl-tools \
clang libc++-dev build-essential autoconf \
libtool pkg-config libssl-dev \
musl ninja-build lrzip \
pkg-config
RUN cargo install --path .
RUN rm -rf /usr/src/app
ENTRYPOINT ["app"]
References
Written on December 23, 2021 at 21:21
Last but not least
If the post is updated, the creation date, will be pushed. So it might happend, you see an existing page back on frontpage. I think, this approach is valid, so wrong information or gained information is covered. But if I am going to write a new part of topic, I might include an updated link to the new post.
Home