bl1231 / bilbomd-ui

Frontend React SPA webapp for new BilboMD
2 stars 0 forks source link

Dockerize? #82

Closed dsclassen closed 1 year ago

dsclassen commented 1 year ago

Should we Dockerize the frontend UI?

dsclassen commented 1 year ago

There are several benefits to dockerizing your React web app:

Portability: Docker containers are platform-agnostic and provide an easy way to package your entire React application, along with its dependencies, into a single container that can be run on any system that supports Docker.

Consistency: Docker containers ensure consistency in the development and deployment environments of your React app. By using the same container in development, testing, and production environments, you can avoid the "works on my machine" problem and eliminate configuration drift.

Scalability: Docker makes it easy to scale your React app horizontally by spinning up multiple containers of the same image. This makes it easier to handle increased traffic to your web app.

Security: Docker containers provide a level of isolation between your React app and the host system, making it harder for attackers to gain access to the host system.

Faster deployment: Docker containers provide a fast and efficient way to deploy your React app to production environments. By packaging your app and its dependencies into a single container, you can reduce the time and effort required to set up and configure the environment.

Overall, Dockerizing your React app can improve the development and deployment process, increase portability, and make your app more secure and scalable.

dsclassen commented 1 year ago

Thank you ChatGPT

datadaveshin commented 1 year ago

Should also ask for the cons:

Docker is a platform used for containerization, which can be particularly helpful in creating a controlled and consistent environment for developing and deploying applications. However, there can be potential downsides to using Docker for a React frontend application, and here are a few of them:

1 Overhead: Docker adds a layer of abstraction and complexity to your application. This is particularly noticeable in small applications where the overhead of setting up Docker might be unnecessary. You have to consider Docker images, containers, Dockerfiles, docker-compose files, and other elements which can be a steep learning curve for beginners.

2 Performance: Docker can have some performance overhead, especially on I/O operations, due to the way containers handle filesystems. While it’s not likely to be a significant problem for frontend applications, it is something to keep in mind.

3 Environment Differences: Docker is designed to create a uniform environment across different systems. However, sometimes you might encounter the situation where something works in the Docker environment but not in the production environment, which can be frustrating to debug.

4 Size of Docker Images: Docker images can become large if not properly managed, which can result in longer build and deploy times. This might slow down the development and deployment processes.

5 Resource Consumption: Docker can be resource-hungry, particularly with regards to disk space, memory, and CPU. This could potentially slow down your development machine if not managed well.

6 Complexity with Live Update/Hot Reloading: Docker can cause some complications with features like hot reloading, which is often used in React development for real-time updates without page refresh.

7 Time-consuming: Setting up Docker, especially in a large React project, can be time-consuming and may also increase the time for building and deploying applications.

In conclusion, while Docker has many benefits, it might not be necessary for every React project, especially small ones or projects where all developers are using the same environment. However, for larger projects and especially for projects meant to be deployed across different environments, Docker can still be a valuable tool despite these cons.

dsclassen commented 1 year ago

Yes, good point. Always good to ask for pros & cons.

dsclassen commented 1 year ago

I'm going to close this for now. I'm currently deploying the frontend code using PM2 as per instructions in bilbomd repo