{"id":16195291,"url":"https://github.com/tethik/php-deployer","last_synced_at":"2025-04-07T15:54:47.906Z","repository":{"id":85966230,"uuid":"92842972","full_name":"Tethik/php-deployer","owner":"Tethik","description":"Takes arbitary php git repo and attempts to run it in docker","archived":false,"fork":false,"pushed_at":"2018-05-21T13:48:02.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-13T18:37:40.610Z","etag":null,"topics":["interview-test"],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/Tethik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2017-05-30T14:42:30.000Z","updated_at":"2018-05-21T13:52:31.000Z","dependencies_parsed_at":"2023-04-19T03:04:17.472Z","dependency_job_id":null,"html_url":"https://github.com/Tethik/php-deployer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tethik%2Fphp-deployer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tethik%2Fphp-deployer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tethik%2Fphp-deployer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tethik%2Fphp-deployer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tethik","download_url":"https://codeload.github.com/Tethik/php-deployer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247685597,"owners_count":20979085,"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":["interview-test"],"created_at":"2024-10-10T08:26:58.645Z","updated_at":"2025-04-07T15:54:47.882Z","avatar_url":"https://github.com/Tethik.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-deployer\nTakes arbitary php git repo and attempts to build it as a docker image.\n\n**This was a code test I did as part of an interview. Maybe someone else can find it useful.**\n\n~**For demo purposes I have put a fresh ssh deploy key with access to the healthcheck repo inside the `credentials` folder. Typically I would not do this for obvious security reasons.**~\n\n# Usage\n1. Clone the directory.\n```bash\ngit clone https://github.com/Tethik/php-deployer\n```\n\n2. Build the docker image.\n```bash\ndocker build --build-arg GITHUB_URI=\"git@github.com:Tethik/healthcheck.git\" \\\n             --build-arg SSH_CREDENTIALS=credentials/* \\\n             --build-arg BUILD_ID=$RANDOM \\\n             --build-arg GIT_SUBDIRECTORY=web/ \\\n             -t php-app .\n```\n\n3. Run the image in a new container\n```bash\ndocker run --env HELLO_WORLD_MSG=\"from Joakim\" -p 80:80 --dns 205.251.197.132 php-app\n```\n\n4. Navigate to [http://localhost/web](http://localhost/web)\n\n\n## Build arguments\nThe dockerfile takes three build arguments.\n\n**GITHUB_URI**: The url to the git repository.\n\n**SSH_CREDENTIALS**: The local relative path to the ssh credentials used for git authentication. (optional)\n\n**BUILD_ID**: An id used to control cache. Set to e.g. `$RANDOM` to avoid caching the git clone that the Dockerfile performs. (optional)\n\n**GIT_SUBDIRECTORY**: Subdirectory inside the git repository containing the actual code. (optional)\n\n## Other examples\n\n### Building a public git repo\nIf we want to build a public repo we can skip the **SSH_CREDENTIALS** build argument.\n```bash\ndocker build --build-arg GITHUB_URI=\"https://github.com/bdart/piibe.git\" \\\n             --build-arg BUILD_ID=$RANDOM \\\n             -t php-app .\n```\n\n## Alternative solution\nhttps://docs.docker.com/engine/reference/commandline/build/#build-with-url\n\nInstead put a Dockerfile at the root of the target repo. Git clone -\u003e docker build instead of repo being built inside the docker image. \nI think this is preferable.\n\n## Existing solution\nSomeone already created something that would fulfill most of the requirements here:\nhttps://hub.docker.com/r/richarvey/nginx-php-fpm/ (https://github.com/ngineered/nginx-php-fpm)\n\nAlthough they don't clone the git repo at build time.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftethik%2Fphp-deployer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftethik%2Fphp-deployer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftethik%2Fphp-deployer/lists"}