-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Ensure container image can be started correctly after build #32
Conversation
974979b
to
79d01f8
Compare
.github/workflows/ci.yml
Outdated
cd neurow && docker build . -t neurow:latest | ||
docker run -d --name neurow_test neurow:latest | ||
sleep 5 | ||
docker stop neurow_test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will not detect anything without a curl. One way to do this is to run a docker compose which start a second container, and curl the first one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes sure, since curl is already included, maybe we can just docker exec
and run the curl inside the started container ?
26cab19
to
23a979e
Compare
2507286
to
8a653a7
Compare
4398261
to
0fa80ce
Compare
0fa80ce
to
0418eb9
Compare
- run: cd neurow && docker build . | ||
- run: | | ||
cd neurow | ||
docker build . -t neurow:${{ github.sha }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way not to build the image twice ? (One time for the check + one time for the actual push)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow runs on every PR, and it's just about building the image (ci.yml
). The one that pushes runs only on main (docker_push.yml
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this step ensure that container image from a PR can be build and started properly.
Changes
This PR adds an extra step on the docker build to ensure that the container is able to start correctly and that the internal API is responding on port 3000 on the ping endpoint.
Since the image is already embarking curl, probably for healthcheck reason, I run the command directly in the container context.
It's also possible to run it directly from the CI env but this will introduce coupling on port used and I think it's can mess up since the host port would not be able to be mapped more than once.