{"id":50965676,"url":"https://github.com/harehare/dockerfile.mq","last_synced_at":"2026-06-18T20:01:57.138Z","repository":{"id":364526507,"uuid":"1268250101","full_name":"harehare/dockerfile.mq","owner":"harehare","description":"A Dockerfile parser implemented as an mq module.","archived":false,"fork":false,"pushed_at":"2026-06-13T10:07:38.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-13T12:09:54.263Z","etag":null,"topics":["dockerfile","markdown","mq"],"latest_commit_sha":null,"homepage":"https://mqlang.org","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/harehare.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-13T10:04:07.000Z","updated_at":"2026-06-13T10:07:42.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/harehare/dockerfile.mq","commit_stats":null,"previous_names":["harehare/dockerfile.mq"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/harehare/dockerfile.mq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harehare%2Fdockerfile.mq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harehare%2Fdockerfile.mq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harehare%2Fdockerfile.mq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harehare%2Fdockerfile.mq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harehare","download_url":"https://codeload.github.com/harehare/dockerfile.mq/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harehare%2Fdockerfile.mq/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34505423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["dockerfile","markdown","mq"],"created_at":"2026-06-18T20:01:54.871Z","updated_at":"2026-06-18T20:01:57.129Z","avatar_url":"https://github.com/harehare.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003edockerfile.mq\u003c/h1\u003e\n\nA Dockerfile parser implemented as an [mq](https://github.com/harehare/mq) module.\n\n## Features\n\n- Parse all standard Dockerfile instructions\n- Multi-stage build support (`FROM ... AS`)\n- Line continuation (`\\`) handling\n- Convenience helpers: `dockerfile_stages`, `dockerfile_ports`, `dockerfile_env`\n\n## Supported Instructions\n\n`FROM` `RUN` `CMD` `LABEL` `EXPOSE` `ENV` `ADD` `COPY` `ENTRYPOINT` `VOLUME` `USER` `WORKDIR` `ARG` `ONBUILD` `STOPSIGNAL` `HEALTHCHECK` `SHELL`\n\n## Installation\n\n```sh\ncp dockerfile.mq ~/.local/mq/config/\n```\n\n### HTTP Import\n\n```sh\nmq -I raw 'import \"github.com/harehare/dockerfile.mq\" | dockerfile::dockerfile_parse(.)' Dockerfile\n```\n\n## API\n\n| Function | Description |\n|---|---|\n| `dockerfile_parse(input)` | Parse a Dockerfile and return an array of instruction dicts |\n| `dockerfile_stringify(instructions)` | Serialize an array of instruction dicts back to a Dockerfile string |\n| `dockerfile_stages(input)` | Return all `FROM` instructions (multi-stage) |\n| `dockerfile_ports(input)` | Return all exposed ports as a flat string array |\n| `dockerfile_env(input)` | Return all `ENV` instructions as a dict |\n\n## Example\n\nGiven `Dockerfile`:\n\n```dockerfile\nFROM node:20-alpine AS builder\nWORKDIR /app\nCOPY package*.json ./\nRUN npm ci\nCOPY . .\nRUN npm run build\n\nFROM node:20-alpine\nWORKDIR /app\nENV NODE_ENV=production\nCOPY --from=builder /app/dist ./dist\nEXPOSE 3000\nCMD [\"node\", \"dist/index.js\"]\n```\n\n```sh\n# List all stages (multi-stage build)\nmq -I raw 'import \"dockerfile\" | dockerfile::dockerfile_stages(.) | map(fn(s): s[\"image\"] + \" AS \" + s[\"alias\"];)' Dockerfile\n# =\u003e [\"node:20-alpine AS builder\", \"node:20-alpine AS None\"]\n\n# Get exposed ports\nmq -I raw 'import \"dockerfile\" | dockerfile::dockerfile_ports(.)' Dockerfile\n# =\u003e [\"3000\"]\n\n# Get environment variables\nmq -I raw 'import \"dockerfile\" | dockerfile::dockerfile_env(.)' Dockerfile\n# =\u003e {\"NODE_ENV\": \"production\"}\n\n# List all RUN commands\nmq -I raw 'import \"dockerfile\" | dockerfile::dockerfile_parse(.) | filter(fn(i): i[\"instruction\"] == \"RUN\";) | map(fn(i): i[\"args\"];)' Dockerfile\n# =\u003e [\"npm ci\", \"npm run build\"]\n\n# Check base image\nmq -I raw 'import \"dockerfile\" | dockerfile::dockerfile_stages(.) | first() | .\"image\"' Dockerfile\n# =\u003e \"node:20-alpine\"\n\n# Round-trip: parse then stringify back to Dockerfile text\nmq -I raw 'import \"dockerfile\" | dockerfile::dockerfile_stringify(dockerfile::dockerfile_parse(.))' Dockerfile\n\n# Modify an instruction and serialize (e.g. bump the base image tag)\nmq -I raw 'import \"dockerfile\" | let instrs = dockerfile::dockerfile_parse(.) | dockerfile::dockerfile_stringify(map(instrs, fn(i): if (i[\"instruction\"] == \"FROM\"): set(i, \"image\", \"node:22-alpine\") else: i;))' Dockerfile\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharehare%2Fdockerfile.mq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharehare%2Fdockerfile.mq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharehare%2Fdockerfile.mq/lists"}