(line: string)
| 44 | } |
| 45 | |
| 46 | function parseFromStatement(line: string): From { |
| 47 | const match = fromStatement.exec(line); |
| 48 | if (!match) { |
| 49 | return { image: 'unknown' }; |
| 50 | } |
| 51 | let { platform, image, label } = match.groups as unknown as From; |
| 52 | image = image.replace(/^['"]|['"]$/g, ''); // remove quotes |
| 53 | return { platform, image, label }; |
| 54 | } |
| 55 | |
| 56 | export function extractDockerfile(dockerfile: string): Dockerfile { |
| 57 | const fromStatementsAhead = /(?=^[\t ]*FROM)/gmi; |
no test coverage detected