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"]