Crates.io | nanoforge |
lib.rs | nanoforge |
version | 0.1.0 |
source | src |
created_at | 2024-03-30 16:16:59.221947 |
updated_at | 2024-03-30 16:16:59.221947 |
description | A tool for pulling docker images, unpacking them, and compiling them into a Rust project |
homepage | |
repository | |
max_upload_size | |
id | 1191186 |
size | 36,362 |
Build and runner tool for nanoservices
We want to work on packaging for operating systems later but for now you can install using the following command:
wget -qO- https://raw.githubusercontent.com/nanoservicesforge/NanoForge/main/scripts/install.sh | sh
Before we can use NanoForge we need to package a nanoservice and build it using scratch
as seen below:
FROM scratch
COPY ./your_package .
And this is enough to package your nanoservice in a Docker image. Now we move onto declaring our nanoservice in our
Cargo.toml
with the following (nan-one
is a real toy example of a nanoservice on Docker Hub):
[nanoservices.nan-one]
dev_image = "maxwellflitton/nan-one"
prod_image = "maxwellflitton/nan-one"
entrypoint = "."
Now we can prepare our build using the following command (you pwd should be the root of your project):
nanoforge prep
This command will create a .nanoservices_cache
and pull the Docker image unpacking the files into the cache. The
build tool will then scan all subdirectories looking for nanoservices in all the Cargo.toml
files in the project.
The relative path will then be calculated for each nanoservice and defined in the Cargo.toml
files. For instance,
our nan-one
nanoservice will have the following path:
[dependencies.nan-one]
path = "../.nanoservices_cache/domain_services/nanoservices/maxwellflitton_nan-one/."
You can then use this in your build.