Should I Separate My Web Server from My Development Environment in Docker?

0
1
Asked By CuriousCoder92 On

I'm planning to move the development of my WordPress site to Docker, but I'm running into some hurdles. The production server is on shared hosting, which limits my control over aspects like the PHP version. I want my local Docker setup to mimic the production environment as closely as possible.

I've got my docker-compose file ready, but I'm debating whether to create a separate service container for my development tools or to just reuse the web server container (the `wordpress` service in my file). The server runs WordPress on Apache, but I also rely on NPM/Node.js development tools, and I want to avoid cluttering my host system.

It seems logical to keep the dev tools separate from the web server to maintain par with the production environment. Plus, it would make it easier to recreate the server image for updates. However, I'm unsure how to effectively map my wp-content folder into the dev environment or if I should maintain two separate copies and deploy from development to production instead. I'm also hoping to use VSCode dev containers, but I'm unclear on how they will fit into my existing docker-compose setup, especially regarding whether Intellisense will function properly if the container is different from the web server. If anyone can guide me on organizing my setup, that would be fantastic! Here's my docker-compose file showing just the web server setup: ...

2 Answers

Answered By DockerDude87 On

It's generally a good idea to keep your web server and your dev tools in separate containers. This way, your production environment stays clean and closer to what it needs to be. Running everything in their own containers minimizes the attack surface too; especially important with Apache and WordPress being popular targets. You can easily manage each component and reduce the risk of conflict between your dev tools and production setup.

Answered By ContainerNinja15 On

I've switched to using containers for everything, including my development tools. I prefer running my web server as a separate stack rather than including it in the main compose setup unless it's the only app I'm hosting. If you plan to use the same stack for other projects or need specific tools, keeping them separate makes it easier. For access, consider binding admin tools to localhost to avoid exposing them publicly.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.