#cargo-toml #dockerfile #workspace #executable #deployment #script #docker-build

build cargo-docker-build

Build Dockerfile and script from Cargo.toml for a Rust workspace project

3 releases

0.1.2 Feb 22, 2023
0.1.1 Feb 20, 2023
0.1.0 Feb 19, 2023

#666 in Build Utils

AGPL-3.0-or-later

18KB
171 lines

docker-build

Helps building the executables in a Rust workspace and deploy them inside minikube

It generates two files:

  • Dockerfile
  • build_docker.sh

When ran from the root of a workspace project, the program will read the Cargo.toml files from every subproject and create a multi stage Dockerfile, that can compile the sources and produce the images.
The ones with the name starting with lib will be ignored.

If the project is not a workspace, it will only generate for the current project.

The images will have labels with information extracted from Cargo.toml

A shell file build_docker.sh will be generated. When run, it will invoke the Dockerfile creation and will tag the newly created images using the labels in the images.

The program will only do the file generation, it will not run anything so you need to run the build_docker.sh manually.

Installation

This program is meant to run as a Cargo subcommand. To install it from source, run:

git clone git@github.com:ovidiu-ionescu/docker-build.git
cd docker-build
cargo install --path .

Dependencies

~1.4–2.1MB
~41K SLoC