Nitrate Processed Mincemeat

    @atomist/sdm-pack-docker
    TypeScript icon, indicating that this package has built-in type declarations

    2.0.2 • Public • Published

    @atomist/sdm-pack-docker

    atomist sdm goals npm version

    Atomist software delivery machine (SDM) extension Pack for an Atomist SDM to integrate docker.

    See the Atomist documentation for more information on what SDMs are and what they can do for you using the Atomist API for software.

    Usage

    Docker Image Creation

    TODO

    Dockerfile Parsing and Manipulation

    This module includes support for parsing Docker files, within the Atomist tree path model. This allows us to query instructions in Docker files and update them without otherwise changing file content or formatting.

    The following example returns the image name:

    const images: string[] = await astUtils.findValues(p, DockerFileParser, "Dockerfile",
         "//FROM/image/name");

    The following example uses DockerFileParser exported by this package, to update an image tag of argon, from node:argon to xenon to produce a file referencing node:xenon.

    await astUtils.doWithAllMatches(p, DockerFileParser, "Dockerfile",
        "//FROM/image/tag",
        n => n.$value = "xenon");

    This example uses a custom function to find all RUN instructions that invoke rm:

    const runs = await astUtils.findValues(p, DockerFileParser, "Dockerfile",
        "//RUN[?removes]",
        {
            removes: n => n.$value.includes("rm "),
        });

    We introduce the pair level to handle LABELs. For example, consider the following input:

    LABEL "com.example.vendor"="ACME Incorporated"
    
    

    The following code queries it:

    const labelKeys = await astUtils.findValues(p, DockerFileParser, "Dockerfile",
                "//LABEL/pair/key");
    assert.strictEqual(labelKeys[0], `com.example.vendor`);
    const labelValues = await astUtils.findValues(p, DockerFileParser, "Dockerfile",
        "//LABEL/pair/value");
    assert.strictEqual(labelValues[0], `ACME Incorporated`);
    const knownKeys = await astUtils.findValues(p, DockerFileParser, "Dockerfile",
        "//LABEL/pair[/key[@value='com.example.vendor']]/value");
    assert.strictEqual(knownKeys[0], `ACME Incorporated`);

    Please see dockerFileParser.test.ts for further examples.

    Support

    General support questions should be discussed in the #support channel in the Atomist community Slack workspace.

    If you find a problem, please create an issue.

    Development

    You will need to install Node to build and test this project.

    Build and test

    Use the following package scripts to build, test, and perform other development tasks.

    Command Reason
    npm install install project dependencies
    npm run build compile, test, lint, and generate docs
    npm run lint run TSLint against the TypeScript
    npm run compile generate types from GraphQL and compile TypeScript
    npm test run tests
    npm run autotest run tests every time a file changes
    npm run clean remove files generated during build

    Release

    Releases are handled via the Atomist SDM. Just press the 'Approve' button in the Atomist dashboard or Slack.


    Created by Atomist. Need Help? Join our Slack workspace.

    Install

    npm i @atomist/sdm-pack-docker

    DownloadsWeekly Downloads

    18

    Version

    2.0.2

    License

    Apache-2.0

    Unpacked Size

    324 kB

    Total Files

    44

    Last publish

    Collaborators

    • atomist-bot
    • cdupuis
    • slimslenderslacks