Anyone with tips about WSL2 with VS Code and Docker Setup (LAMP with Docker)?
Hello!
The last few days I used my free time and dealt with some topics that should help me to make my development more efficient. Now I've reached the point "How can I set up a docker for use with VS code". So far I have read the documentation and I can also set up a running container with a code folder in it and also get "php artisan serve" running. Next I want to improve the setup and make the environment more like on the production system. That means I want to create different containers for php, redis and mysl with docker-compose. I'm a bit stuck at this point and may not see any trees because of the forest. So far I'm experienced with docker and also run some servers productively with it, what's missing is the experience how to connect it with VS code.
So my question is: Does anybody have WSL2 running with docker and below that docker-compose with a LAMP setup, like I'm want? And can anyone give me tips on how to get it running or how to integrate it with VS Code? In my case I want run a (API) backend and want develope there.
My sample docker-compose.yml:
version: "3"
services:
proxy:
image: nginx:alpine
restart: "no"
volumes:
- ../../core/setup/preset/proxy/etc/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf
- ../../core/setup/preset/proxy/srv/www:/srv/www
- ./data/proxy/var/log/nginx:/var/log/nginx
env_file:
- ./config/docker.env
depends_on:
- backend
- management
- administration
networks:
- webservices
- default
redis:
image: redis
restart: "no"
sysctls:
- net.core.somaxconn=512
database:
image: mysql:5.7
restart: "no"
env_file:
- ./config/database.env
volumes:
- ./data/database/var/lib/mysql:/var/lib/mysql
backend:
build:
context: /docker/core/setup/files/php72-apache-vdb
dockerfile: Dockerfile
restart: "no"
#ports:
# - "8080:80"
working_dir: /var/www/html
volumes:
- ./data/backend/srv/www:/var/www/html
- /docker/core/setup/preset/backend-apache/etc/crontab:/etc/crontab
- /docker/core/setup/preset/backend-apache/run.sh:/run.sh
- /docker/core/setup/preset/backend-apache/etc/apache2/envvars:/etc/apache2/envvars
- /docker/core/setup/preset/backend-apache/etc/apache2/apache2.conf:/etc/apache2/apache2.conf
- /docker/core/setup/preset/backend-apache/etc/apache2/sites-enabled/000-default.conf:/etc/apache2/sites-enabled/000-default.conf
depends_on:
- database
- redis
env_file:
- ./config/backend.env
management:
build:
context: /docker/core/setup/files/nginx-vuejs
dockerfile: Dockerfile
restart: "no"
environment:
NODE_ENV: production
working_dir: /app
restart: always
volumes:
- ./data/management/app:/app
- ./data/management/var/log/nginx:/var/log/nginx
command: ["nginx"]
administration:
build:
context: /docker/core/setup/files/nginx-vuejs
dockerfile: Dockerfile
restart: "no"
environment:
NODE_ENV: production
working_dir: /app
restart: always
volumes:
- ./data/administration/app:/app
- ./data/administration/var/log/nginx:/var/log/nginx
command: ["nginx"]
Please or to participate in this conversation.