Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DockerGenerator

A Dockerfile generator that collects instructions from all the other generators to allow for images that support multiple languages.

Hierarchy

Index

Constructors

constructor

  • new DockerGenerator(urlFetcher: UrlFetcher, environ: SoftwareEnvironment, folder?: undefined | string, baseImage?: undefined | string): DockerGenerator

Properties

Optional baseImage

baseImage: undefined | string

Manually define the image to inherit FROM

environ

environ: SoftwareEnvironment

The software environment for which a Dockerfile will be generated

folder

folder: string

The directory to scan for relevant files

Protected generators

generators: Array<Generator>

The child generators from which this 'super' generator collects instructions.

Protected Readonly urlFetcher

urlFetcher: UrlFetcher

The instance of IUrlFetcher to fetch URLs

Methods

applies

  • applies(): boolean

aptKeysCommand

  • aptKeysCommand(sysVersion: string): string | undefined

aptPackages

  • aptPackages(sysVersion: string): Array<string>

aptRepos

  • aptRepos(sysVersion: string): Array<string>

baseIdentifier

  • baseIdentifier(): string

baseName

  • baseName(): string

baseVersion

  • baseVersion(): string

baseVersionName

  • baseVersionName(baseIdentifier: string): string

Private collect

  • collect(func: any): Array<any>
  • Collect arrays of string from each child generator and flatten them into an array of strings. Used below for method overrides.

    Parameters

    • func: any

      The child generator method to call

    Returns Array<any>

envVars

  • envVars(sysVersion: string): Array<[string, string]>

exists

  • exists(subpath: string): boolean
  • Does a path exist within the project folder?

    Parameters

    • subpath: string

      The path within the folder

    Returns boolean

fetch

  • fetch(url: string, options?: any): Promise<any>
  • Fetch content from a URL

    Parameters

    • url: string

      The URL to fetch

    • Default value options: any = { responseType: 'json' }

      Request options

    Returns Promise<any>

generate

  • generate(comments?: boolean, stencila?: boolean): string
  • Generate a Dockerfile for a SoftwareEnvironment instance

    Parameters

    • Default value comments: boolean = true

      Should a comments be added to the Dockerfile?

    • Default value stencila: boolean = false

      Should relevant Stencila language packages be installed in the image?

    Returns string

glob

  • glob(pattern: string | Array<string>): Array<string>
  • Get a list of paths that match a pattern in the project folder.

    Parameters

    • pattern: string | Array<string>

      The glob pattern

    Returns Array<string>

installCommand

  • installCommand(sysVersion: string): string | undefined

installFiles

  • installFiles(sysVersion: string): Array<[string, string]>

Private join

  • join(func: any, sep?: string): string
  • Join strings from each child generator

    Parameters

    • func: any

      The child generator method to call

    • Default value sep: string = " \&& "

    Returns string

projectFiles

  • projectFiles(sysVersion: string): Array<[string, string]>

read

  • read(subpath: string): string
  • Read a file within the project folder

    Parameters

    • subpath: string

      The path within the folder

    Returns string

runCommand

  • runCommand(sysVersion: string): string | undefined

stencilaInstall

  • stencilaInstall(sysVersion: string): string | undefined

write

  • write(subpath: string, content: string): void
  • Write to a file within the project folder

    Parameters

    • subpath: string

      The path within the folder

    • content: string

      The content to write to the file

    Returns void

Generated using TypeDoc