gothinkster / spring-boot-realworld-example-app

Example Spring codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld API spec.
MIT License
1.31k stars 680 forks source link

Dockerized #3

Closed dockerizeallthethings closed 6 years ago

dockerizeallthethings commented 6 years ago

Adding a dockerfile that builds the project (using a gradle base docker image, rather than the gradlew) and generates a Docker image to run the resulting jar in a container. Adding instructions to the README.md to run a working example of the app in a docker container from an image hosted on hub.docker.com.

Please feel free to provide feedback or suggestions.

--RG

aisensiy commented 6 years ago

It is good, but the docker container does not work unless you create the mysql container as well. Why not create a docker-compose yaml for it.

dockerizeallthethings commented 6 years ago

@aisensiy ok, fair enough 😄 . I thought there was a built in database, but I wasn't really sure how to test the api (I just hit a couple of endpoints to make sure it was running, and just figured the database was empty). I'll close for now and reopen when I have the db part working. Thanks!

dockerizeallthethings commented 6 years ago

I'm not sure what the app expects the db location to be. Is there a default mysql hostname Spring Boot / MyBatis expects? (I'm trying to not make any changes directly to the codebase, so I'm hoping to use default values, or some environment variable configuration)

Also is there a good way to smoke test the running API?

aisensiy commented 6 years ago

Yes, my fault. The application have a default built in database. And I think right now the dockerizing code is good enough to make it run as a test environment. I will merge it. Thank you.

And if you want to know how to connect mysql with spring boot app the link may be helpful: https://spring.io/guides/gs/accessing-data-mysql/