{"id":22489682,"url":"https://github.com/rcjsuen/dockerfile-ast","last_synced_at":"2025-12-25T21:57:25.940Z","repository":{"id":27582756,"uuid":"114495944","full_name":"rcjsuen/dockerfile-ast","owner":"rcjsuen","description":"An npm module for parsing Dockerfiles powered by TypeScript.","archived":false,"fork":false,"pushed_at":"2024-11-09T21:08:20.000Z","size":642,"stargazers_count":41,"open_issues_count":7,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-09T22:18:56.794Z","etag":null,"topics":["ast","docker","dockerfile","dockerfiles","moby","parse","parser"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rcjsuen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"License.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"rcjsuen"}},"created_at":"2017-12-16T23:09:26.000Z","updated_at":"2024-11-09T21:08:24.000Z","dependencies_parsed_at":"2024-06-18T15:14:42.600Z","dependency_job_id":null,"html_url":"https://github.com/rcjsuen/dockerfile-ast","commit_stats":{"total_commits":299,"total_committers":2,"mean_commits":149.5,"dds":"0.010033444816053505","last_synced_commit":"a9641b158d09d5720bd6068b1a8e5b8ba3934c7c"},"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcjsuen%2Fdockerfile-ast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcjsuen%2Fdockerfile-ast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcjsuen%2Fdockerfile-ast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcjsuen%2Fdockerfile-ast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rcjsuen","download_url":"https://codeload.github.com/rcjsuen/dockerfile-ast/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228500420,"owners_count":17930062,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ast","docker","dockerfile","dockerfiles","moby","parse","parser"],"created_at":"2024-12-06T17:20:25.026Z","updated_at":"2025-12-25T21:57:25.864Z","avatar_url":"https://github.com/rcjsuen.png","language":"TypeScript","funding_links":["https://github.com/sponsors/rcjsuen"],"categories":["TypeScript"],"sub_categories":[],"readme":"# Dockerfile AST\n\n![Node.js Builds](https://github.com/rcjsuen/dockerfile-ast/workflows/Node.js%20Builds/badge.svg?branch=master) [![Coverage Status](https://coveralls.io/repos/github/rcjsuen/dockerfile-ast/badge.svg?branch=master)](https://coveralls.io/github/rcjsuen/dockerfile-ast?branch=master) [![Build Dependencies](https://david-dm.org/rcjsuen/dockerfile-ast.svg)](https://david-dm.org/rcjsuen/dockerfile-ast) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm downloads per week](https://img.shields.io/npm/dw/dockerfile-ast.svg)](https://www.npmjs.com/package/dockerfile-ast)\n\nThe `dockerfile-ast` NPM module is a Dockerfile parser written in TypeScript.\nThe module provides full programmatic access to a parsed Dockerfile.\n\nSupported features:\n- escaped newline detection\n  - `escape` parser directive considered when parsing\n- comments preserved\n  - inlined comments in multiline instructions preserved\n- continuous empty newlines honoured (albeit discouraged as of Docker CE 17.09)\n- `ARG` and `ENV` variable lookup and resolution\n\nUnsupported:\n- `\\r` as a a line delimiter\n  - only `\\r\\n` and `\\n` are supported as being line delimiters\n  - if a `\\r` is detected the parser assumes that it is followed by a `\\n`\n\n## Development Instructions\n\nIf you wish to build and compile this project, you must first install [Node.js](https://nodejs.org/en/download/) if you have not already done so.\nAfter you have installed Node.js and cloned the repository with Git, you may now proceed to build and compile the project with the following commands:\n\n```\nnpm install\nnpm run build\nnpm test\n```\n\nIf you are planning to change the code, use `npm run watch` to get the\nTypeScript files transpiled on-the-fly as they are modified.\n\n## Installation Instructions\n\nTo add this library as a dependency to your project, please add `dockerfile-ast` as a dependency in your package.json file.\n\n## Using this Module\n\n```TypeScript\nimport { DockerfileParser } from 'dockerfile-ast';\n\nconst content =\n`FROM alpine\nExposE 8080`\n\nlet dockerfile = DockerfileParser.parse(content);\nlet instructions = dockerfile.getInstructions();\nfor (let instruction of instructions) {\n  // FROM\n  // EXPOSE\n  console.log(instruction.getKeyword());\n  // FROM\n  // ExposE\n  console.log(instruction.getInstruction());\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frcjsuen%2Fdockerfile-ast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frcjsuen%2Fdockerfile-ast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frcjsuen%2Fdockerfile-ast/lists"}