UNPKG

3.29 kBMarkdownView Raw
1# @atomist/sdm-pack-docker
2
3[![atomist sdm goals](http://badge.atomist.com/T29E48P34/atomist/sdm-pack-docker/275b4284-9942-41c8-9b91-e90957d99188)](https://app.atomist.com/workspace/T29E48P34)
4[![npm version](https://img.shields.io/npm/v/@atomist/sdm-pack-docker.svg)](https://www.npmjs.com/package/@atomist/sdm-pack-docker)
5
6[Atomist][atomist] software delivery machine (SDM) extension Pack for an Atomist SDM to
7integrate [docker](https://www.docker.io).
8
9See the [Atomist documentation][atomist-doc] for more information on
10what SDMs are and what they can do for you using the Atomist API for
11software.
12
13[atomist-doc]: https://docs.atomist.com/ (Atomist Documentation)
14
15## Usage
16
17### Docker Image Creation
18
19TODO
20
21### Dockerfile Parsing and Manipulation
22
23This module includes support for parsing Docker files, within the Atomist
24[tree path](https://github.com/atomist/tree-path) model. This allows us to
25query instructions in Docker files and update them without otherwise changing
26file content or formatting.
27
28The following example returns the image name:
29
30```typescript
31const images: string[] = await astUtils.findValues(p, DockerFileParser, "Dockerfile",
32 "//FROM/image/name");
33```
34
35The following example uses `DockerFileParser` exported by this package, to update
36an image tag of `argon`, from `node:argon` to `xenon` to produce a file referencing
37`node:xenon`.
38
39```typescript
40await astUtils.doWithAllMatches(p, DockerFileParser, "Dockerfile",
41 "//FROM/image/tag",
42 n => n.$value = "xenon");
43```
44
45This example uses a custom function to find all `RUN` instructions that invoke `rm`:
46
47```typescript
48const runs = await astUtils.findValues(p, DockerFileParser, "Dockerfile",
49 "//RUN[?removes]",
50 {
51 removes: n => n.$value.includes("rm "),
52 });
53```
54
55Please see `dockerFileParser.test.ts` for further examples.
56
57## Support
58
59General support questions should be discussed in the `#support`
60channel in the [Atomist community Slack workspace][slack].
61
62If you find a problem, please create an [issue][].
63
64[issue]: https://github.com/atomist/sdm-pack-docker/issues
65
66## Development
67
68You will need to install [Node][node] to build and test this project.
69
70[node]: https://nodejs.org/ (Node.js)
71
72### Build and test
73
74Use the following package scripts to build, test, and perform other
75development tasks.
76
77Command | Reason
78------- | ------
79`npm install` | install project dependencies
80`npm run build` | compile, test, lint, and generate docs
81`npm run lint` | run TSLint against the TypeScript
82`npm run compile` | generate types from GraphQL and compile TypeScript
83`npm test` | run tests
84`npm run autotest` | run tests every time a file changes
85`npm run clean` | remove files generated during build
86
87### Release
88
89Releases are handled via the [Atomist SDM][atomist-sdm]. Just press
90the 'Approve' button in the Atomist dashboard or Slack.
91
92[atomist-sdm]: https://github.com/atomist/atomist-sdm (Atomist Software Delivery Machine)
93
94---
95
96Created by [Atomist][atomist].
97Need Help? [Join our Slack workspace][slack].
98
99[atomist]: https://atomist.com/ (Atomist - How Teams Deliver Software)
100[slack]: https://join.atomist.com/ (Atomist Community Slack)
101
102[atomist]: https://atomist.com/ (Atomist - Development Automation)
103[slack]: https://join.atomist.com/ (Atomist Community Slack)