hudy9x / namviek

The open-source project manager for tiny teams
https://namviek.com
MIT License
1.79k stars 206 forks source link

feat: Docker #183

Closed FranciscoJBrito closed 1 month ago

FranciscoJBrito commented 1 month ago

Features

1 - To reduce the size of the Dockerfile I used an Alpine image of Node.

2 - Added the entrypoints.sh file, to run the yarn commands.

3 - Additionally add the docker-compose file to include redis, because otherwise you would get an error when running the backend. For it to work correctly, the variable REDIS_HOST=host.docker.internal:6379 must be added to the .env file

4- Added .dockerignore to reduce the size of the Dockerfile as much as possible

There are still areas for improvement, but this first version works.


Reference

179

vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **namviek-5o9o** | ⬜️ Ignored ([Inspect](https://vercel.com/hudys-projects/namviek-5o9o/EVCGDmPdbE6ozo8PXAa5xr6NJG4F)) | [Visit Preview](https://namviek-5o9o-git-fork-franciscojbrito-fea-c850fd-hudys-projects.vercel.app) | | May 26, 2024 5:23am |
hudy9x commented 1 month ago

@FranciscoJBrito I have some comments as follows

FranciscoJBrito commented 1 month ago

@hudy9x great, we take these points as future mods or would they be necessary to merge this PR?

In case they are needed for the merge, let me know what environment variables you want to add. I am currently passing the .env.local file as env_file argument in docker-compose.

On the other hand, the database you mentioned adding as a service in docker-compose, do you mean adding mongodb

hudy9x commented 1 month ago

@FranciscoJBrito

we take these points as future mods or would they be necessary to merge this PR?

It should be resolved this PR

In case they are needed for the merge, let me know what environment variables you want to add. I am currently passing the .env.local file as env_file argument in docker-compose.

For now, just use your version

On the other hand, the database you mentioned adding as a service in docker-compose, do you mean adding mongodb

Yes. But it's up to you. Because I think MongoDb Atlas still was the best choice

FranciscoJBrito commented 1 month ago

@hudy9x for now, I prefer not to add mongo as a service in docker-compose, I did some tests and the app performs better if the connection is with Atlas.

hudy9x commented 1 month ago

@FranciscoJBrito I see build field in backend service, but the frontend service does. Based on my limited Docker experience, there should be an additional "build" field and Docker file in the docker-compose If you're not planned to implement the frontend service this time, please remove it. And leave Backend + Redis service.

P/S: I wonder that could we put all files that relate to Docker into a folder /dockers ?

FranciscoJBrito commented 1 month ago

@hudy9x the build field is for building the Dockerfile, if I added the build in both services what I would be doing is building the image twice, which is unnecessary and a waste of resources. So what I do is build the image once on the backend, and then on the frontend I use the image previously built in the backend service. In conclusion, rest assured that it is the same image in both services, we build it only once and use it twice.

Regarding adding the files inside a /docker folder, of course, it is a good idea to maintain organization, the only files I have to leave in the root are the docker-compose and .dockerignore, but the rest I will add in the /docker folder.

hudy9x commented 1 month ago

@FranciscoJBrito Ok, i got it. I'll merge this PR once you complete the updates.