From 2296ab555746f26bed4eb5e7b1bbf8c605c0fd4d Mon Sep 17 00:00:00 2001 From: Noel Palo Date: Tue, 7 Sep 2021 23:45:32 +0800 Subject: [PATCH] Docker Study - Update Structure -- Create separate Dockerfile for each container -- Update docker compose --- docker/containers/composer/Dockerfile | 6 ++++++ docker/containers/mysql/Dockerfile | 2 ++ docker/containers/nginx/Dockerfile | 2 ++ docker/docker-compose.yml | 18 ++++++++++++++---- src/composer.json | 2 +- src/composer.lock | 16 ++++++++-------- 6 files changed, 33 insertions(+), 13 deletions(-) create mode 100644 docker/containers/composer/Dockerfile create mode 100644 docker/containers/mysql/Dockerfile create mode 100644 docker/containers/nginx/Dockerfile diff --git a/docker/containers/composer/Dockerfile b/docker/containers/composer/Dockerfile new file mode 100644 index 0000000..3612d61 --- /dev/null +++ b/docker/containers/composer/Dockerfile @@ -0,0 +1,6 @@ +# Install Composer +FROM composer:2.1.5 + +# Copy PHP from previous Dockerfile with a tag of php:php-7.4-fpm-alpine +# See docker/docker-compose.yml +COPY --from=php:php-7.4-fpm-alpine /usr/local/bin/php /usr/local/bin/php \ No newline at end of file diff --git a/docker/containers/mysql/Dockerfile b/docker/containers/mysql/Dockerfile new file mode 100644 index 0000000..03ca982 --- /dev/null +++ b/docker/containers/mysql/Dockerfile @@ -0,0 +1,2 @@ +# Install MySQL +FROM library/mysql:5.7.22 diff --git a/docker/containers/nginx/Dockerfile b/docker/containers/nginx/Dockerfile new file mode 100644 index 0000000..aabe13a --- /dev/null +++ b/docker/containers/nginx/Dockerfile @@ -0,0 +1,2 @@ +# Install NginX +FROM library/nginx:stable-alpine diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index d1ad96e..bb8a1b5 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3' +version: '3.7' networks: web-app: @@ -9,7 +9,10 @@ services: networks: - web-app container_name: nginx - image: library/nginx:stable-alpine + build: + context: . + dockerfile: containers/nginx/Dockerfile + image: nginx:nginx-stable-alpine ports: - "9100:80" volumes: @@ -24,7 +27,10 @@ services: networks: - web-app container_name: mysql - image: library/mysql:5.7.22 + build: + context: . + dockerfile: containers/mysql/Dockerfile + image: mysql:mysql-5.7.22 restart: unless-stopped tty: true ports: @@ -58,7 +64,11 @@ services: networks: - web-app container_name: composer - image: composer:2.1.5 + build: + context: . + dockerfile: containers/composer/Dockerfile + image: composer:composer-2.1.5 + #image: composer:2.1.5 working_dir: /var/www/html volumes: - "${PATH_PROJECT_SOURCE}:/var/www/html" diff --git a/src/composer.json b/src/composer.json index 8e2b2d7..6dac3b2 100644 --- a/src/composer.json +++ b/src/composer.json @@ -8,7 +8,7 @@ ], "license": "MIT", "require": { - "php": "^7.1.3", + "php": "^7.4", "fideloper/proxy": "^4.0", "laravel/framework": "5.8.*", "laravel/tinker": "^1.0" diff --git a/src/composer.lock b/src/composer.lock index b810784..2dd501c 100644 --- a/src/composer.lock +++ b/src/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "94d4bf9ac7f4a933030e46a346ee2917", + "content-hash": "230ffdc4ded638370dd6bc632c8ad3cf", "packages": [ { "name": "dnoegel/php-xdg-base-dir", @@ -916,16 +916,16 @@ }, { "name": "nesbot/carbon", - "version": "2.52.0", + "version": "2.53.1", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "369c0e2737c56a0f39c946dd261855255a6fccbe" + "reference": "f4655858a784988f880c1b8c7feabbf02dfdf045" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/369c0e2737c56a0f39c946dd261855255a6fccbe", - "reference": "369c0e2737c56a0f39c946dd261855255a6fccbe", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/f4655858a784988f880c1b8c7feabbf02dfdf045", + "reference": "f4655858a784988f880c1b8c7feabbf02dfdf045", "shasum": "" }, "require": { @@ -937,7 +937,7 @@ }, "require-dev": { "doctrine/orm": "^2.7", - "friendsofphp/php-cs-fixer": "^2.14 || ^3.0", + "friendsofphp/php-cs-fixer": "^3.0", "kylekatarnls/multi-tester": "^2.0", "phpmd/phpmd": "^2.9", "phpstan/extension-installer": "^1.0", @@ -1006,7 +1006,7 @@ "type": "tidelift" } ], - "time": "2021-08-14T19:10:52+00:00" + "time": "2021-09-06T09:29:23+00:00" }, { "name": "nikic/php-parser", @@ -5950,7 +5950,7 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "^7.1.3" + "php": "^7.4" }, "platform-dev": [], "plugin-api-version": "2.1.0"