{"id":28302151,"url":"https://github.com/qiushihe/docker-builder","last_synced_at":"2026-04-28T12:02:03.357Z","repository":{"id":64303325,"uuid":"191113725","full_name":"qiushihe/docker-builder","owner":"qiushihe","description":"A CLI Dockerfile templating tool.","archived":false,"fork":false,"pushed_at":"2019-06-24T00:37:37.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-31T03:51:42.310Z","etag":null,"topics":["cli","docker","dockerfile","template"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":false,"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/qiushihe.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}},"created_at":"2019-06-10T06:54:13.000Z","updated_at":"2019-06-24T00:35:10.000Z","dependencies_parsed_at":"2023-01-15T10:00:26.321Z","dependency_job_id":null,"html_url":"https://github.com/qiushihe/docker-builder","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/qiushihe/docker-builder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qiushihe%2Fdocker-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qiushihe%2Fdocker-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qiushihe%2Fdocker-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qiushihe%2Fdocker-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qiushihe","download_url":"https://codeload.github.com/qiushihe/docker-builder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qiushihe%2Fdocker-builder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32379629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T11:25:28.583Z","status":"ssl_error","status_checked_at":"2026-04-28T11:25:05.435Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cli","docker","dockerfile","template"],"created_at":"2025-05-23T20:13:43.609Z","updated_at":"2026-04-28T12:02:03.350Z","avatar_url":"https://github.com/qiushihe.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker Builder\n\n**Docker Builder** is a `Dockerfile` templating tool. It allows one to turn a `Dockerfile.template`:\n\n```\nFROM %%BASE_IMAGE%%\n\n%%INSTALL_COMMON_PACKAGES%%\n\nRUN apk add apache2 %%PHP_PACKAGES%%\n\nCOPY %%_COMMON/scripts/mount-nfs.sh%% /mount-nfs.sh\nCOPY src/run-server.sh /run-server.sh\nRUN chmod +x /run-server.sh\n\nENTRYPOINT [\"/run-server.sh\"]\n```\n\n... into a `Dockerfile`:\n\n```\nFROM alpine:3.9\n\nRUN apk add bash\nRUN apk add shadow\nRUN apk add wget\n\nRUN apk add apache2 php7\n\nCOPY scripts/mount-nfs.sh%% /mount-nfs.sh\nCOPY src/run-server.sh /run-server.sh\nRUN chmod +x /run-server.sh\n\nENTRYPOINT [\"/run-server.sh\"]\n```\n\n## Download and Install\n\nDownload **Docker Builder** from [the release page](https://github.com/qiushihe/docker-builder/releases).\n\nPut the extracted `docker-builder` CLI binary somewhere on your `PATH`, or not since **Docker Builder** doesn't care where it's being run from nor does it care where all the directories are.\n\n## How to Use Docker Builder\n\nTo use **Docker Builder**, first setup a container image directory structure as follow:\n\n* `/path/to/my-image/`\n  * `src/`\n    * `entry.sh`\n\n      ```\n      #!/usr/bin/env bash\n      # This is the entry script, so do whatever you want in here.\n      echo \"Hallo!\"\n      while true; do sleep 5; done\n      ```\n\n  * `Dockerfile.template`\n\n    ```\n    FROM %%BASE_IMAGE%%\n    COPY src/entry.sh /entry.sh\n    RUN chmod +x /run-server.sh\n    ENTRYPOINT [\"/run-server.sh\"]\n    ```\n\n  * `Dockerfile.variables`\n\n    ```\n    BASE_IMAGE: alpine:3.9\n    ```\n\n... then run the `docker-builder` CLI tool:\n\n```\n$ docker-builder -src /path/to/my-image -- -t my-image\n```\n\nRunning the above command would generate a `_docker-build` directory that looks like:\n\n* `/path/to/my-image/_docker-build`\n  * `src/`\n    * `entry.sh`\n  * `Dockerfile`\n\n    ```\n    FROM alpine:3.9\n    COPY src/entry.sh /entry.sh\n    RUN chmod +x /run-server.sh\n    ENTRYPOINT [\"/run-server.sh\"]\n    ```\n\n... and then invoke `docker build -t my-image` to build the image.\n\n### Reference Block Values\n\nUnlike one line string values which are stored in `Dockerfile.variables`, block values are stored in `Dockerfile.variables.d` directories.\n\nConsider this example:\n\n* `/path/to/my-image/`\n  * `src/`\n    * `entry.sh`\n  * `Dockerfile.template`\n\n    ```\n    FROM %%BASE_IMAGE%%\n    %%INSTALL_PACKAGES%%\n    COPY src/entry.sh /entry.sh\n    RUN chmod +x /run-server.sh\n    ENTRYPOINT [\"/run-server.sh\"]\n    ```\n\n  * `Dockerfile.variables`\n\n    ```\n    BASE_IMAGE: alpine:3.9\n    ```\n\n  * `Dockerfile.variables.d/`\n    * INSTALL_PACKAGES\n      \n      ```\n      RUN apk add bash wget \\\n        zip unzip \\\n        shadow\n      ```\n\nThe above setup would generate this:\n\n* `/path/to/my-image/_docker-build`\n  * `src/`\n    * `entry.sh`\n  * `Dockerfile`\n\n    ```\n    FROM alpine:3.9\n    RUN apk add bash wget \\\n        zip unzip \\\n        shadow\n    COPY src/entry.sh /entry.sh\n    RUN chmod +x /run-server.sh\n    ENTRYPOINT [\"/run-server.sh\"]\n    ```\n\n### Reference External Values\n\nOther than `Dockerfile.variables` and `Dockerfile.variables.d` within the image's directory itself, **Docker Builder** can also be told to take any number of other directories into consideration.\n\nConsider this example:\n\n* `/path/to/somewhere/else/`\n  * `configs/`\n    * `httpd.conf`\n\n      ```\n      ... some apache2 httpd configuration ...\n      ```\n  * `Dockerfile.variables`\n\n    ```\n    APACHE_PORTS: 80 443\n    ```\n  \n  * `Dockerfile.variables.d`\n    * `APACHE_PACKAGES`\n\n      ```\n      RUN apk add apache2 apache2-proxy\n      ```\n\n* `/path/to/my-image/`\n  * `src/`\n    * `entry.sh`\n  * `Dockerfile.template`\n\n    ```\n    FROM %%BASE_IMAGE%%\n    %%INSTALL_PACKAGES%%\n    %%APACHE_PACKAGES%%\n    COPY %%_COMMON/configs/httpd.conf%% /etc/apache2/httpd.conf\n    COPY src/entry.sh /entry.sh\n    EXPOSE %%APACHE_PORTS%%\n    RUN chmod +x /run-server.sh\n    ENTRYPOINT [\"/run-server.sh\"]\n    ```\n\n  * `Dockerfile.variables`\n\n    ```\n    BASE_IMAGE: alpine:3.9\n    ```\n\n  * `Dockerfile.variables.d/`\n    * INSTALL_PACKAGES\n      \n      ```\n      RUN apk add bash wget \\\n        zip unzip \\\n        shadow\n      ```\n\nRunning this command:\n\n```\n$ docker-build -src /path/to/my-image -lib /path/to/somewhere/else -- -t my-image\n```\n\n... would generate:\n\n* `/path/to/my-image/_docker-build`\n  * `src/`\n    * `entry.sh`\n  * `configs/`\n    * `httpd.conf`\n  * `Dockerfile`\n\n    ```\n    FROM alpine:3.9\n    RUN apk add bash wget \\\n        zip unzip \\\n        shadow\n    RUN apk add apache2 apache2-proxy\n    COPY configs/httpd.conf /etc/apache2/httpd.conf\n    COPY src/entry.sh /entry.sh\n    EXPOSE 80 443\n    RUN chmod +x /run-server.sh\n    ENTRYPOINT [\"/run-server.sh\"]\n    ```\n\nAnd you can specify multiple `-lib /PATH/TO/LIB` options.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqiushihe%2Fdocker-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqiushihe%2Fdocker-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqiushihe%2Fdocker-builder/lists"}