Closed Wildschut closed 2 years ago
Thanks for working on this. Sure, feel free to revert them (e.g. using an interactive rebase). Let me know if you need a hand with this
Kudos, SonarCloud Quality Gate passed!
Hi @knjk04 , I think I've managed to revert the changes I made.
Can you please check if that is the case?
Specifically the impact of these 4 commits:
If this fails (the git revert) I'll rather delete my fork and just redo the whole thing.
Hi @knjk04 ,
I've reverted the commits that are causing the build to fail.
Is there step(s) that I'm missing?
Hi @Wildschut, the build is passing now
@Wildschut Thanks a lot for this, I can see you've put a lot of thought into this!
I haven't been able to run this on Windows. Did you test this on Unix?
Hi @knjk04 , yes this was developed on an ubuntu machine.
I was heavily inspired by apache guacamole, so credit where credit is due...
That being said: The OS shouldn't matter as long as the *.sh files have their line endings with LR and not CRLR.
You should be able to verify if this is the case in intellij by opening the start.sh and looking in the bottom right (I think).
The dockerfile itself should be platform agnostic. And the build of the jar itself, the files get copied over to a linux container and compiled inside it, so thats abstracted away from the platform as well...
Otherwise, please share your output so I can help trace what is wrong/where its failing.
Hi @knjk04 , had you managed to get it running?
Any feedback for me?
Hi @Wildschut, I'm so sorry for the delay in getting back to you (frankly, I forgot).
I'm using Docker Desktop on Windows (Docker Engine v20.10.8). I have buildkit enabled:
"features": {
"buildkit": true
}
I have also set it via Powershell using the answer from dev-null: https://stackoverflow.com/questions/62984255/docker-buildkit-for-docker-for-windows.
Output of docker-compose build booksapi
: https://gist.github.com/knjk04/15c4cba690ac74dfd522a4b77be33b8c.
http://localhost:8080/graphiql:
It looks like the db is running, but the backend isn't:
Do you know what I might be missing/doing wrong? I'd imagine this is something wrong on my end (perhaps something else I need to do on Windows), so I can continue to look into this on my end
Hi @knjk04 ,
Thanks for getting back to me :D
Ok, so from the output you've shared the build is passing. So the booksapi image is being created.
Now what remains is to run the image - create an container.
Can you please share the output of the following command docker-compose up booksapi
Please also share the docker-compose.yml. I'd like to verify the env's your passing...
I dont think windows is the issue here because you're able to run other containers...
After running docker-compose build --build-arg mvn_arg="clean package -DskipTests" booksapi
:
PS C:\Users\karan\playground\bapi-docker-139> docker-compose up booksapi
Creating network "bapi-docker-139_default" with the default driver
Creating booksapi ... done
Attaching to booksapi
: No such file or directory
booksapi exited with code 127
PS C:\Users\karan\playground\bapi-docker-139>
It looks like it's still not running. See docker-compose.
Ok, based off the error you've received (127), the start.sh file attributes (line endings) has been changed.
Please execute the follow ps command:
Get-Content ./docker/bin/start.sh
-raw | % {$_ -replace "`r", ""} | Set-Content -NoNewline ./docker/bin/start.sh
Then refresh the image by rebuilding it:
docker-compose build --build-arg mvn_arg="clean package -DskipTests"
Finally generate an container of the refreshed image:
docker-compose up booksapi
@Wildschut Do you have an update on this?
Hi @knjk04 , was out of the loop for a while.
I'll resolve it within 3 days. Once done, I'll mention you so this van move forward.
Thanks
Kudos, SonarCloud Quality Gate passed!
@Wildschut I've made the necessary changes, as someone else's work depends on this. Thanks a lot for all of your help with this!
Summary of change
Create Multistage Dockerfile to build maven project. Define booksapi service in docker-compose with required parameters. Create the container database dependency "checkpoint" shell. This script validates the passed environment variables or lack thereof. Update the README.md to document the new required workflow with examples.
Related issue
Closes #134
Pull request checklist
Please keep this checklist in & ensure you have done the following:
[x] Read, understood and adhered to our contributing document.
[x] Read, understood and adhered to our style guide. A lot of our code reviews are spent on ensuring compliance with our style guide, so it would save a lot of time if this was adhered to from the outset.
[x] Filled in the summary, context (if applicable) and related issue section. Replace the square brackets and its placeholder content with your contents. For an example, see any merged in pull request
[x] Created a branch that has a descriptive name (what your branch is for in a few words and includes the issue number at the end, e.g.
test-reading-goal-123
[x] Set this pull request to 'draft' if you are still working on it
[x] Resolved any merge conflicts
For any of the optional checkboxes (e.g. the screenshots one), still check it if it does not apply.
If in doubt, get in touch with us via our Slack workspace or by creating a new Q&A discussion on GitHub