{"id":21184502,"url":"https://github.com/matthewpattell/docker-server","last_synced_at":"2025-07-10T00:33:33.422Z","repository":{"id":62525233,"uuid":"141270903","full_name":"MatthewPattell/docker-server","owner":"MatthewPattell","description":"Universal docker server (PHP-FPM/NODE, Nginx, MySql, Redis). Launch your site in 5 steps and \u003c5 min :)","archived":false,"fork":false,"pushed_at":"2022-01-19T23:01:28.000Z","size":408,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-16T23:13:25.822Z","etag":null,"topics":["autoconf","docker","docker-compose","express","hostsfile","mysql","node","nodejs","php-fpm","proxy","redis","templates","universal","web"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MatthewPattell.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}},"created_at":"2018-07-17T10:04:32.000Z","updated_at":"2022-01-04T14:11:10.000Z","dependencies_parsed_at":"2022-11-02T14:15:45.363Z","dependency_job_id":null,"html_url":"https://github.com/MatthewPattell/docker-server","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatthewPattell%2Fdocker-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatthewPattell%2Fdocker-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatthewPattell%2Fdocker-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatthewPattell%2Fdocker-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MatthewPattell","download_url":"https://codeload.github.com/MatthewPattell/docker-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225606570,"owners_count":17495551,"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":["autoconf","docker","docker-compose","express","hostsfile","mysql","node","nodejs","php-fpm","proxy","redis","templates","universal","web"],"created_at":"2024-11-20T18:09:07.426Z","updated_at":"2024-11-20T18:09:09.180Z","avatar_url":"https://github.com/MatthewPattell.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"Universal docker server\n===========================\nNginx (1.17.8), PHP (7.4) / Node (13.10), MySql (5.7), Redis (5.0.7)\n\nInstallation\n------------\n\nThe preferred way to install this extension.\n\nEither run\n\n - for **composer** \n    ```bash\n    php composer.phar require --prefer-dist matthew-p/docker-server\n    ```\n   \n   or add\n   \n   ```\n   \"matthew-p/docker-server\": \"^5.1.0\"\n   ```\n   \n   to the require section of your `composer.json` file.\n - for **npm**\n    ```bash\n    npm i --save @matthew-p/docker-server@latest\n    ```\n   or add\n   \n   ```\n   \"@matthew-p/docker-server\": \"^1.1.1\"\n   ```\n   to the dependencies section of your `package.json` file.\n\n## After install package:\n\n1. Add or update section **scripts** in **composer.json** or **package.json**:  \n\n    - for **composer.json**\n        ```json5\n        {\n            \"scripts\": {\n                \"server\": \"vendor/bin/site-start.sh --env-file=docker/.env.local\",\n                \"server-run\": \"vendor/bin/site-run.sh --env-file=docker/.env.local\",\n                \"server-exec\": \"vendor/bin/site-exec.sh --env-file=docker/.env.local\",\n    \n                // (optional)\n                \"server-prod\": \"vendor/bin/site-aws.sh --env-file=docker/.env.prod\",\n                // (optional)\n                \"server-deploy-dev\": \"vendor/bin/site-deploy.sh --env-file=docker/.env.dev\"\n            }\n        }\n        ```\n   - for **package.json**\n       ```json5\n       {\n           \"scripts\": {\n               \"server\": \"docker-server-start --env-file=docker/.env.local\",\n               \"server-run\": \"docker-server-run --env-file=docker/.env.local\",\n               \"server-exec\": \"docker-server-exec --env-file=docker/.env.local\",\n   \n               // (optional)\n               \"server-prod\": \"docker-server-aws --env-file=docker/.env.prod\",\n               // (optional)\n               \"server-deploy-dev\": \"docker-server-deploy --env-file=docker/.env.dev\"\n           }\n       }\n       ```\n   \n    where **\"docker/.env.local\"** relative path to your local env config _(will be created in next step)_.\n\n1. Run: ```composer server init``` or ```npm run server init```. This will create a **docker** folder in your project root directory.\n\n1. Change **root-path** in _docker/nginx/conf-dynamic.d/sample.conf_\n\n1. See [supported os](#supported-os) and config **docker/.env.local** according to your operating system\n\n1. Run server: ```composer server up ``` or ```npm run server up```\n\n## Supported OS\n - [Linux](docs/LINUX.md)\n - [Mac OS](docs/MACOS.md)\n \n## Environments \u0026\u0026 Commands\n - [See all available environments](docs/ENVIRONMENTS.md)\n - [See console commands](docs/COMMANDS.md)\n \n## PhpStorm samples\n - [Deploy config](phpstorm/SAMPLE_DEPLOY_CONFIG.xml)\n \n## Latest docker images\n - NGINX\n    - matthewpatell/universal-docker-nginx:3.7\n - SERVER\n    - matthewpatell/universal-docker-server:4.0\n    - matthewpatell/universal-docker-server:4.0-dev\n    - matthewpatell/universal-docker-server:4.0-jre (with java)\n - PHP-FPM:\n    - matthewpatell/universal-docker-server-php-fpm:4.0\n - NODE:\n    - node:13.10-alpine\n\n**FEATURES**\n---\n- Multiple config: ```vendor/bin/site-start.sh --env-file=docker/.env.dev,docker/.env.local```\n- Use environment, extends, overriding between configs\n    ```dotenv\n    # Simple usage\n    SERVICES=\"$SERVICES -f my.yml\"\n    \n    # Will be recompiled (bad example)\n    SERVICES=\"${SERVICES} -f my.yml\"\n    \n    # Will be recompiled (good example)\n    SERVICES=\"${SERVICES_EXTERNAL} -f my.yml\"\n    ```\n- Use all environments in docker-compose files\n- Overriding, extends docker-compose files\n- Run container and execute command: ```composer server-run server \"ls \u0026\u0026 top\"```\n- Run command in working container: ```composer server-exec server \"composer install\"```\n- AWS create/update \"Task Definitions\"\n- Auto update _/etc/hosts_ file on host machine\n- Auto create nginx proxies on host machine\n- Deploy\n- And etc.  \n\n## LIFEHACKS\n- Configure hosts file:\n    1. Check nginx container _IP_ and add to hosts file:\n        \n        ```bash\n        docker inspect sample_nginx\n        ```\n        \n        view **\"IPAddress\"** and add to:\n        \n        ```bash\n        sudo nano /etc/hosts\n        ```\n        \n        _172.18.0.4 sample.io_ (for example)  \n        save and check it.\n    2. Open browser and check **sample.io**\n\n    OR see below **static network layer**\n  \n- **Add static network layer** _(only for Linux)_\n    1. Change **SERVICES** variable in your local env (docker/.env.local) to:\n        ```dotenv\n        SERVICES=\"$SERVICES -f docker/docker-compose.common.yml -f docker/docker-compose.static-network.yml\"\n        ```\n    2. Run: ```composer server restart``` and check it.\n- **Update package without composer install and depencies**\n\n    - with composer image:\n    \n    ```bash\n    docker run --rm --interactive --volume $PWD:/app composer update --ignore-platform-reqs --no-scripts\n    ```\n    \n    - with server images:\n\n    ```bash\n    docker run --rm --interactive --volume $PWD:/app matthewpatell/universal-docker-server:4.0 bash -c 'cd /app \u0026\u0026 composer install --no-scripts'\n    ```\n        \n    - with server image and additional global packages:\n        \n    ```bash\n    docker run --rm --interactive --volume $PWD:/app matthewpatell/universal-docker-server:4.0 bash -c 'cd /app \u0026\u0026 composer global require \"fxp/composer-asset-plugin:^1.4.2\" \u0026\u0026 composer global require \"hirak/prestissimo:~0.3.7\" \u0026\u0026 composer install --no-scripts'\n    ```\n    \n- Use git-container instead of git itself\n\n```bash\n\ndocker run -it --rm \\\n        --user $(id -u):$(id -g) \\\n        -v $HOME:$HOME:rw \\\n        -v /etc/passwd:/etc/passwd:ro \\\n        -v /etc/group:/etc/group:ro \\\n        -v $PWD:$PWD:rw \\\n        -w $PWD \\\n        alpine/git \\\n        clone [command]\n\n# Or add alias in ~/.profile (change `git` to any another keyword if git actually installed)\ncat \u003e\u003e ~/.profile \u003c\u003c EOF\n    function git () {\n        (docker run -it --rm --user \\$(id -u):\\$(id -g) -v \\$HOME:\\$HOME:rw -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -v \\$PWD:\\$PWD:rw -w \\$PWD alpine/git \"\\$@\")\n    }\nEOF\nsource ~/.profile\n# and use via alias\ngit clone git@githab.com:foob/bar.git .\ngit pull\n```\n\nThat's all. Check it. :)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatthewpattell%2Fdocker-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatthewpattell%2Fdocker-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatthewpattell%2Fdocker-server/lists"}