The build command

The build command is the key part of the roche development workflow.

It's specifically designed to compress rust build times to seconds rather than minutes.

That said it's intention is to be easy to operate from a developer point of view.

See the complete list of options for build by executing the following

roche build --help


If you a looking for a quick end to end guide to get up and running then please refer to the simple tutorial. This section aims to outline some of the detail behind that tutorial.

In the default scenario build can be executed from either the project root or the same folder with the function file in.

roche build

docker username config By default roche will try and obtain your current docker or podman user to generate the build tag.

Unfortunately older versions of docker on non-linux environments don't output complete docker info.

This can be resolved by either supplying a --tag option or setting a DOCKER_USERNAME environment variable.


Behind the scenes there are 4 things going on.

  1. A Dockerfile is created in memory and piped to the docker command on the local machine.

  2. The Dockerfile contains the build system for the function that has been compiled previously so dependencies are ready made.

  3. The final build artefact is then passed to the runtime image to ensure a clean build is achieved.

  4. Docker then applies the tag to the built image.

This is a sample Dockerfile that drives this flow.

FROM as builder
COPY /app-build/src/app
RUN cargo build --release
RUN apk add --no-cache libgcc
RUN addgroup -S rocheuser && adduser -S rocheuser -G rocheuser
WORKDIR "/app"
COPY --from=builder --chown=rocheuser /app-build/ /app-build/Cargo.toml /app-build/target/debug/roche-service INCLUDE_ENV ./
USER rocheuser

The options allow you to override the two images used in the from clauses as well as the output container tag

roche build \
--buildimage \
--runtime \
--tag namespace/buildname:version

environment files

Roche supports environment files. Simply create a .env file in the same location as the and it will be included in the development build. See the env example for more details.