From 8daed9327c0fdcaa4ecb7274fc27a5ca6b7753a3 Mon Sep 17 00:00:00 2001 From: Tommy Stigen Olsen Date: Wed, 7 Feb 2024 17:59:50 +0100 Subject: [PATCH] Update devcontainer --- .../.devcontainer.json | 32 ++---------- .devcontainer/docker-compose.yml | 49 +++++++++++++++++++ .env.example | 2 +- 3 files changed, 55 insertions(+), 28 deletions(-) rename .devcontainer.json => .devcontainer/.devcontainer.json (55%) create mode 100644 .devcontainer/docker-compose.yml diff --git a/.devcontainer.json b/.devcontainer/.devcontainer.json similarity index 55% rename from .devcontainer.json rename to .devcontainer/.devcontainer.json index d6acdce..3da4303 100644 --- a/.devcontainer.json +++ b/.devcontainer/.devcontainer.json @@ -1,38 +1,16 @@ { - "image":"php:8.3-fpm", + "image": "php:8.3-fpm", "customizations": {}, "mounts": [ + "source=/,target=/workspace,type=bind,consistency=delegated" ], "remoteEnv": { "COMPOSER_ALLOW_SUPERUSER": "1" }, "postCreateCommand": "apt-get update && apt-get install -y build-essential postgresql-client libpng-dev libjpeg62-turbo-dev libfreetype6-dev libzip-dev locales zip jpegoptim optipng pngquant gifsicle git unzip && mkdir /workspace && cd /workspace && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && apt-get install -y libpq-dev && docker-php-ext-install pdo_pgsql && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash && export NVM_DIR=\"$HOME/.nvm\" && [ -s \"$NVM_DIR/nvm.sh\" ] && \\. \"$NVM_DIR/nvm.sh\" && [ -s \"$NVM_DIR/bash_completion\" ] && \\. \"$NVM_DIR/bash_completion\"", - "services": { - "db": { - "image": "postgres:14", - "ports": ["5432:5432"], - "environment": { - "MYSQL_DATABASE": "laravel", - "MYSQL_USER": "laravel", - "MYSQL_PASSWORD": "password", - "MYSQL_ROOT_PASSWORD": "password" - }, - "volumes": ["postgres_data:/var/lib/postgresql/data"] - }, - "redis": { - "image": "redis:latest", - "ports": ["6379:6379"], - "volumes": ["redis_data:/data"] - }, + "dockerComposeFile": ".devcontainer/docker-compose.yml", + "service": "app", "forwardPorts": [ - 8000, - 5432, - "db:5432", - "redis:6379" - ], - "volumes": [ - "postgres_data:/var/lib/postgresql/data", - "redis_data:/data" + "8000:8000" ] - } } diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 0000000..98ea51b --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,49 @@ +version: '3' + +networks: + laravel: + +services: + app: + image: php:8.1-fpm + environment: + DB_CONNECTION: pgsql + DB_HOST: postgres + DB_PORT: 5432 + DB_DATABASE: video_sub + DB_USERNAME: postgres + DB_PASSWORD: postgres + MAIL_HOST: mailhog + depends_on: + - postgres + - redis + - mailhog + links: + - postgres + - redis + - mailhog + postgres: + image: postgres:14-alpine + ports: + - "5432:5432" + volumes: + - postgres_data:/var/lib/postgresql/data + environment: + - POSTGRES_PASSWORD=postgres + - POSTGRES_USER=postgres + - POSTGRES_DB=video_sub + networks: + - laravel + redis: + image: redis:latest + ports: + - 6379:6379 + mailhog: + image: mailhog/mailhog:latest + ports: + - "1025:1025" + - "8025:8025" + networks: + - laravel +volumes: + postgres_data: diff --git a/.env.example b/.env.example index ea0665b..c1586e9 100644 --- a/.env.example +++ b/.env.example @@ -29,7 +29,7 @@ REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_MAILER=smtp -MAIL_HOST=mailpit +MAIL_HOST=mailhog MAIL_PORT=1025 MAIL_USERNAME=null MAIL_PASSWORD=null