{"id":29702591,"url":"https://github.com/devgateway/dkr2sh","last_synced_at":"2025-07-23T12:39:42.939Z","repository":{"id":33947350,"uuid":"150463619","full_name":"devgateway/dkr2sh","owner":"devgateway","description":"Convert Dockerfile to shell script","archived":false,"fork":false,"pushed_at":"2022-02-23T11:32:18.000Z","size":5,"stargazers_count":24,"open_issues_count":1,"forks_count":11,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-04-15T15:31:30.247Z","etag":null,"topics":["bash","bash-script","converter","docker","dockerfile","sed","shell","shell-script"],"latest_commit_sha":null,"homepage":null,"language":"sed","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/devgateway.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":"2018-09-26T17:23:05.000Z","updated_at":"2024-03-11T07:35:26.000Z","dependencies_parsed_at":"2022-08-07T23:30:54.480Z","dependency_job_id":null,"html_url":"https://github.com/devgateway/dkr2sh","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/devgateway/dkr2sh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgateway%2Fdkr2sh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgateway%2Fdkr2sh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgateway%2Fdkr2sh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgateway%2Fdkr2sh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devgateway","download_url":"https://codeload.github.com/devgateway/dkr2sh/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgateway%2Fdkr2sh/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266680692,"owners_count":23967795,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["bash","bash-script","converter","docker","dockerfile","sed","shell","shell-script"],"created_at":"2025-07-23T12:39:42.335Z","updated_at":"2025-07-23T12:39:42.922Z","avatar_url":"https://github.com/devgateway.png","language":"sed","readme":"# dkr2sh - convert Dockerfile to shell script\n\nThis script naively translates some Dockerfile instructions into corresponding shell commands.\n\n## Conversion Rules\n\n### Instructions commented out\n\n* FROM\n* CMD\n* LABEL\n* MAINTAINER\n* EXPOSE\n* ENTRYPOINT\n* VOLUME\n* ARG\n* ONBUILD\n* STOPSIGNAL\n* HEALTHCHECK\n\nTranslate these instructions manually:\n\n* USER - execute the next block(s) with `su` or equivalent\n* SHELL - unwrap JSON-formatted arguments, run it for subsequent block(s)\n\n### ENV\n\nBefore:\n\n    ENV FOO bar\n\nAfter:\n\n    export FOO=bar\n\n### RUN\n\nBefore:\n\n    RUN /usr/bin/foo \\\n        \u0026\u0026 /sbin/bar --quux\n\nAfter:\n\n    /usr/bin/foo \\\n        \u0026\u0026 /sbin/bar --quux\n\n### COPY\n\n`COPY` behaves differently on files and directories, so we use `rsync` to emulate *recursive\ncontent copying* on directories.\n\nIf `--from` argument is given, it becomes just a comment, because unlike Docker images (and ogres),\nshell scripts don't have layers.\n\nBefore:\n\n    COPY --from=composer foo.sh /usr/local/bin/\n\nAfter:\n\n    for i in foo.sh; do\n            test -d \"$i\" \u0026\u0026 i=\"$i/\"\n            rsync -a \"$i\" /usr/local/bin/ # --from=composer\n    done\n\n### WORKDIR\n\nBefore:\n\n    WORKDIR /var/lib/pgsql/10.1\n\nAfter:\n\n    mkdir -p /var/lib/pgsql/10.1 \u0026\u0026 cd /var/lib/pgsql/10.1\n\n### ADD\n\n`ADD` has [many rules](https://docs.docker.com/v17.09/engine/reference/builder/#add), and transforms\ninto a fairly large snippet.\n\nBefore:\n\n    ADD https://example.org/foo.bin /opt\n\nAfter:\n\n    if echo \"/opt\" | grep -q '/$'; then\n            mkdir -p \"/opt\";\n    else\n            mkdir -p \"$(dirname \"/opt\")\";\n    fi\n\n    for i in https://example.org/foo.bin; do\n            if echo \"$i\" | grep -q '^\\(https\\?\\|ftp\\)://'; then\n                    if echo \"/opt\" | grep -q '/$'; then\n                            (cd \"/opt\" \u0026\u0026 wget -q \"$i\");\n                    else\n                            wget -q -O \"/opt\" \"$i\";\n                    fi\n            elif test -d \"$i\"; then\n                    rsync -a \"$i/\" \"/opt\";\n            elif tar -tf \"$i\" \u003e/dev/null 2\u003e\u00261; then\n                    mkdir -p \"/opt\" \u0026\u0026 tar -C \"/opt\" -xf \"$i\";\n            else\n                    rsync -a \"$i\" \"/opt\";\n            fi\n    done\n\n## Copyright\n\nCopyright 2018, Development Gateway\n\nThis program is free software: you can redistribute it and/or modify it under the terms of\nthe GNU General Public License as published by the Free Software Foundation, either version 3 of\nthe License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\neven the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See\nthe GNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License along with this program. If not,\nsee \u003chttps://www.gnu.org/licenses/\u003e.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevgateway%2Fdkr2sh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevgateway%2Fdkr2sh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevgateway%2Fdkr2sh/lists"}