samay-app / samay

Find a time which works for everyone
https://samay.app
MIT License
307 stars 60 forks source link

Adding Dockerfile and example docker-compose.yml #186

Closed TetrisBlack closed 2 years ago

TetrisBlack commented 2 years ago

Adding support for docker, like in the example of next.js https://github.com/vercel/next.js/tree/canary/examples/with-docker

Note: I have not tested the application itself. I did build and start the docker container and created an account (to test the db connection). I'm also not a React guy, the addition to the next.config.js was taken out of the linked example of next.js

Related Issue:

86

anandbaburajan commented 2 years ago

@TetrisBlack thank you for the PR! May I know why you closed this?

TetrisBlack commented 2 years ago

@AnandBaburajan sure. After some testing, I got a problem with the env's not changing, then using the next experimental standalone option. It seems like the frontend always has the wrong env's. The backend connection to the MongoDB could be configured via env's. So, my assumption is, that the next build is compiling the frontend code with the currently defined env as a static and not as a dynamic value.

I found the with-docker-multi-env repo. With, let me think, that the env needs to be set before the build. That would not be in the intention of a configurable docker container.

I don't think that the official way of next, to build docker container is working in this project. To make the project possible for docker, you would need to build the application on container startup with the needed env's defined. But that would mean that the docker image will be huge and has a slow startup. (The official way is 123 MB right now)

So the reason why I closed my pull request is, that it don't work like it should be.

anandbaburajan commented 2 years ago

@TetrisBlack thank you for the kickstart! I'm new to Docker so your comment is really valuable. I'll look further into it.