The gen command

The gen command is used to generate a Dockerfile that can be shipped with your function. This enables CI/CD scenarios where the preference is not to allow the roche cli to proliferate outside of development environments.

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

roche gen --help


To take the default settings run

roche gen

This will create the following Dockerfile which is identical to the one created during the release command.

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/release/roche-service ./
USER rocheuser

For more information on how this file see the release documentation.

If you are using a custom baseimage or a custom runtime then these can be overridden using the appropriate options.

roche gen --buildimage --runtime

By default the Dockerfile is configured to expect the file to be in the same folder.

This of course is modifiable by editing the location of the in the COPY line. For example you may wish to have the Dockerfile in the root of your project so the line could be edited as follows

COPY src/ /app-build/src/app