{"id":18986861,"url":"https://github.com/karllhughes/docker-php-cli-example","last_synced_at":"2025-04-19T20:45:00.487Z","repository":{"id":77519995,"uuid":"86825706","full_name":"karllhughes/docker-php-cli-example","owner":"karllhughes","description":"Example of a Laravel PHP cli application running in Docker containers and using Codeship for CI","archived":false,"fork":false,"pushed_at":"2017-04-17T15:04:31.000Z","size":183,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T13:12:13.110Z","etag":null,"topics":["codeship","docker","laravel","php"],"latest_commit_sha":null,"homepage":"https://blog.codeship.com/building-a-php-command-line-app-with-docker/","language":"PHP","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/karllhughes.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}},"created_at":"2017-03-31T14:05:41.000Z","updated_at":"2023-04-24T18:27:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"f07dbd62-d7c4-4af4-9900-f90163c8b342","html_url":"https://github.com/karllhughes/docker-php-cli-example","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/karllhughes%2Fdocker-php-cli-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karllhughes%2Fdocker-php-cli-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karllhughes%2Fdocker-php-cli-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karllhughes%2Fdocker-php-cli-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karllhughes","download_url":"https://codeload.github.com/karllhughes/docker-php-cli-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249795655,"owners_count":21326780,"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":["codeship","docker","laravel","php"],"created_at":"2024-11-08T16:37:13.653Z","updated_at":"2025-04-19T20:45:00.470Z","avatar_url":"https://github.com/karllhughes.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sample Command Line PHP/Docker Application\n\n[ ![Codeship Status for karllhughes/docker-php-cli-example](https://app.codeship.com/projects/95ab9250-05a3-0135-8091-7a325a44f9f4/status?branch=master)](https://app.codeship.com/projects/213574)\n\nThis is a simple Laravel command line application demonstrating using Docker and Docker Compose for PHP application development, continuous integration, and deployment through the [Codeship Pro platform](https://codeship.com/features/pro).\n\n## Commands\nFor convenience, I have wrapped a number of common docker commands in `npm` scripts. For more details, see the `package.json` file.\n\n- `npm run -s app:up` Starts up the application and database using Docker Compose.\n- `npm run -s app:restart` Restarts the application making any code changes take effect.\n- `npm run -s app:down` Brings down the application and database.\n- `npm run -s app:test` Runs the test suite.\\*\n- `npm run -s artisan -- ARTISAN:COMMAND` Wrapper to run artisan commands.\\*\n- `npm run -s artisan -- item:update` Update the next item's `checked_at` date.\n- `npm run -s composer:install` Install PHP packages via composer.\n- `npm run -s composer:update` Update PHP packages via composer.\n- `npm run -s composer:dump` Wrapper for composer `dump-autoload` command.\n\n\\* Note: The app must be running in order to run this command.\n\n## Local development\nIn order to run this project locally for development, uncomment these lines in the `docker-compose` file that mount the code as a volume:\n\n```yaml\n  app:\n    build: .\n    links:\n      - database\n    env_file:\n      - .env\n    command: cron -f\n    # Uncomment these lines:\n    volumes:\n     - ./:/app\n```\n\nThis will ensure that any updates you make take effect immediately in the application container.\n\nRun the composer install command:\n\n```bash\n$ npm run -s composer:install\n```\n\nNow, copy `.env.example` to `.env` and customize with your own variables and keys.\n\nNext, run the npm command to bring up the docker containers:\n\n```bash\n$ npm run -s app:up\n```\n\nIf it's your first time running this app, set up the database:\n\n```bash\n$ npm run -s db:create      # Creates the database\n$ npm run -s db:migrate     # Runs the migrations\n$ npm run -s db:seed        # Seeds the database\n```\n\nNow you can run the app's primary artisan command:\n\n```bash\n$ npm run -s artisan -- item:update\n```\n\nTo bring the containers down when you're finished:\n\n```bash\n$ npm run -s app:down\n```\n\n## Testing Locally\n\n### Testing within containers\n\nOnce the app is set up and running, you can run the acceptance test:\n\n```bash\n$ npm run -s app:test\n```\n\nThis runs phpunit from within the running application container.\n\n### Testing and deploying with Jet\n\nIf you have [Codeship's Jet installed](https://documentation.codeship.com/pro/getting-started/installation/), you can run tests from Jet as well.\n\nFirst, bring the application down (if it's running):\n\n```bash\n$ npm run -s app:down\n```\n\nGenerate an AES encryption key:\n\n```bash\n$ jet generate\n```\n\nEncrypt your .env files:\n\n```bash\n$ jet encrypt .env .env.encrypted \u0026\u0026 jet encrypt deployer/.env deployer/.env.encrypted\n```\n\nBuild the containers, run the tests, and deploy the latest on the master branch:\n\n```bash\n$ jet steps\n```\n \n## Continuous integration with Codeship\n\nThis project was built to use [Codeship's Docker continuous integration platform](https://codeship.com/features/pro).\n\n1. Copy your [Codeship AES key](https://documentation.codeship.com/pro/getting-started/encryption/#getting-the-key) into a file called `codeship.aes` at the root of this project.\n\n2. Make sure your `deployer/.env` file is filled out with your server information and private rsa key (with no line breaks).\n\n2. Encrypt your .env files: `$ jet encrypt .env .env.encrypted \u0026\u0026 jet encrypt deployer/.env deployer/.env.encrypted`\n\n3. Push your code to a repository that is attached to a Codeship Pro CI instance.\n\nThis should run your tests and deploy your code to the server specified in `deployer/.env`\n\n## License\n\nThis is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarllhughes%2Fdocker-php-cli-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarllhughes%2Fdocker-php-cli-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarllhughes%2Fdocker-php-cli-example/lists"}