From 1cb2957a43f5f90bd3d3ca95ae55400ed9d4c2a9 Mon Sep 17 00:00:00 2001 From: Theodore Messinezis Date: Thu, 1 Jul 2021 00:00:44 +0100 Subject: [PATCH] feat: use mysql instead of pgsql --- .env.example | 6 +++--- cli/Dockerfile | 4 ++-- docker-compose.yaml | 9 ++++----- fpm/Dockerfile | 4 ++-- readme.md | 14 +++++++------- 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/.env.example b/.env.example index 321c29e..45dff66 100644 --- a/.env.example +++ b/.env.example @@ -7,9 +7,9 @@ APP_URL=http://localhost LOG_CHANNEL=stack LOG_LEVEL=debug -DB_CONNECTION=pgsql -DB_HOST=postgres -DB_PORT=5432 +DB_CONNECTION=mysql +DB_HOST=mysql +DB_PORT=3306 DB_DATABASE=laravel DB_USERNAME=root DB_PASSWORD= diff --git a/cli/Dockerfile b/cli/Dockerfile index ffe5497..af83373 100644 --- a/cli/Dockerfile +++ b/cli/Dockerfile @@ -6,8 +6,8 @@ RUN addgroup -g 1000 -S user && adduser -u 1000 -D user -G user RUN apk add --no-cache bash curl git vim # Install composer for php deps. RUN apk add --no-cache composer -# Install postgres pdo driver. -RUN apk add --no-cache postgresql-dev && docker-php-ext-install pdo_pgsql +# Install mysql pdo driver. +RUN apk add --no-cache mysql-dev && docker-php-ext-install pdo_mysql # Install redis driver. RUN mkdir -p /usr/src/php/ext/redis; \ curl -fsSL --ipv4 https://github.com/phpredis/phpredis/archive/5.3.4.tar.gz | tar xvz -C "/usr/src/php/ext/redis" --strip 1; \ diff --git a/docker-compose.yaml b/docker-compose.yaml index 0b89bb8..d110f20 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -20,12 +20,11 @@ services: depends_on: - fpm - postgres: - image: postgres:13-alpine + mysql: + image: mysql:8 environment: - POSTGRES_DB: laravel - POSTGRES_USER: root - POSTGRES_HOST_AUTH_METHOD: trust + MYSQL_DATABASE: laravel + MYSQL_ALLOW_EMPTY_PASSWORD: affirm redis: image: redis:6.2-alpine diff --git a/fpm/Dockerfile b/fpm/Dockerfile index 4d208ee..748a96a 100644 --- a/fpm/Dockerfile +++ b/fpm/Dockerfile @@ -1,7 +1,7 @@ # From official php image. FROM php:8.0-fpm-alpine -# Install postgres pdo driver. -RUN apk add --no-cache postgresql-dev && docker-php-ext-install pdo_pgsql +# Install mysql pdo driver. +RUN apk add --no-cache mysql-dev && docker-php-ext-install pdo_mysql # Install redis driver. RUN mkdir -p /usr/src/php/ext/redis; \ curl -fsSL --ipv4 https://github.com/phpredis/phpredis/archive/5.3.4.tar.gz | tar xvz -C "/usr/src/php/ext/redis" --strip 1; \ diff --git a/readme.md b/readme.md index fe78ffe..ea849bb 100644 --- a/readme.md +++ b/readme.md @@ -12,10 +12,10 @@ Visual Studio Code will actually run inside a Docker container with php-cli as w Any Extensions will also run in the same container, meaning that intellisense will use the same php-cli configuration! `laravel-devcontainer` currently ships with: -- `php:8.0-cli-alpine` workspace with composer, pgsql, redis, and nodejs. -- `php:8.0-fpm-alpine` container with phsql and redis extensions. +- `php:8.0-cli-alpine` workspace with composer, mysql, redis, and nodejs. +- `php:8.0-fpm-alpine` container with mysql and redis extensions. - `nginx:1.21-alpine` preconfigured for your Laravel application. -- `postgres:13-alpine` preconfigured with the default Laravel credentials. +- `mysql:8` preconfigured with the default Laravel credentials. - `redis:6.2-alpine` for caching, queues, sessions, etc. #### Easy Installation @@ -38,12 +38,12 @@ git clone --recurse-submodules ... #### Usage Start Visual Studio Code (e.g. `code example-app`) and re-open in remote containers (`Remote-Containers: Reopen in Container`). This may take some time on the first use, as Docker initially downloads and builds the images. Eventually, Visual Studio Code will run inside the workspace container. Extensions and settings specified in `devcontainer.json` will be auto-configured! -Be sure to correctly configure your application `.env` to use the devcontainer postgres and redis. For example: +Be sure to correctly configure your application `.env` to use the devcontainer mysql and redis. For example: ```env -DB_CONNECTION=pgsql -DB_HOST=postgres -DB_PORT=5432 +DB_CONNECTION=mysql +DB_HOST=mysql +DB_PORT=3306 DB_DATABASE=laravel DB_USERNAME=root DB_PASSWORD=