NickPriv / FryRankBackend

A back-end Java application allowing users to create and view reviews for french fries at restaurants
https://fryrank.oxyserver.com
0 stars 0 forks source link

Refactor Dockerfile #52

Closed oxyflush closed 5 months ago

oxyflush commented 5 months ago

This commit fixes an issue with the Dockerfile previously where the jar needed to be built on the local machine and copied into the docker container. This causes issues if the local machine is unable to build the correct jar and is not in line with containerization principles.

Additionally, fix the compose.yaml to properly expose the correct ports so that the main class does not need to be run again to correctly expose and forward the ports.

Lastly add, an env sample file so that the correct envs can be passed into compose.yaml so that the correct env variables make it into the docker container to be used by the jar.

oxyflush commented 5 months ago

Could you test and see what startup time looks like when spinning up a new ecodyno? Is it 10 seconds longer than previously or should it be the same?

So this change doesn't actually make heroku deploy the docker image. It still will build and run the jar separately outside of the container. I took a brief look into what it would take to make heroku deploy docker images, and it would require us to write a heroku.yml which resembles a compose.yml but for heroku only. I also took a look at the limitations and was wondering if we would want to discuss this separately before I went ahead and implemented. For now, this change is only to standardize the way we build and run applications locally.

NickPriv commented 5 months ago

Could you test and see what startup time looks like when spinning up a new ecodyno? Is it 10 seconds longer than previously or should it be the same?

So this change doesn't actually make heroku deploy the docker image. It still will build and run the jar separately outside of the container. I took a brief look into what it would take to make heroku deploy docker images, and it would require us to write a heroku.yml which resembles a compose.yml but for heroku only. I also took a look at the limitations and was wondering if we would want to discuss this separately before I went ahead and implemented. For now, this change is only to standardize the way we build and run applications locally.

Cool, sounds good then

oxyflush commented 5 months ago

Added changes to the README. Please take a look when you get the chance. Bundled it with these changes since it's so closely related.