Skip to main content

export_dockerfile

Function export_dockerfile 

Source
pub fn export_dockerfile(
    session: &Session,
    params: Option<&[Parameter]>,
) -> String
Expand description

Export a session as a Dockerfile.

Generates a Dockerfile with:

  • Metadata header comments (session name, date, command count)
  • FROM ubuntu:22.04 base image
  • ARG declarations when parameters are provided
  • WORKDIR instructions when the working directory changes
  • One RUN instruction per command (no escaping needed)
  • Annotations for failed commands (non-zero exit codes)

When params is Some, ARG declarations are added after the FROM line and commands use $VAR references.

Empty sessions produce a valid Dockerfile with a “No commands recorded” comment.