Skip to content
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

Merged
merged 12 commits into from
Oct 4, 2024

Conversation

papey
Copy link
Member

@papey papey commented Oct 4, 2024

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.

@papey papey self-assigned this Oct 4, 2024
@papey papey requested a review from gcxRun as a code owner October 4, 2024 08:06
@papey papey marked this pull request as draft October 4, 2024 08:07
@papey papey force-pushed the add-curl-check-before-pushing-image branch from 974979b to 79d01f8 Compare October 4, 2024 08:08
cd neurow && docker build . -t neurow:latest
docker run -d --name neurow_test neurow:latest
sleep 5
docker stop neurow_test
Copy link
Contributor

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.

Copy link
Member Author

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 ?

@papey papey force-pushed the add-curl-check-before-pushing-image branch from 26cab19 to 23a979e Compare October 4, 2024 08:29
@papey papey force-pushed the add-curl-check-before-pushing-image branch from 2507286 to 8a653a7 Compare October 4, 2024 08:48
@papey papey force-pushed the add-curl-check-before-pushing-image branch 2 times, most recently from 4398261 to 0fa80ce Compare October 4, 2024 09:01
@papey papey force-pushed the add-curl-check-before-pushing-image branch from 0fa80ce to 0418eb9 Compare October 4, 2024 09:13
@papey papey requested a review from bpaquet October 4, 2024 09:38
@papey papey marked this pull request as ready for review October 4, 2024 09:38
- run: cd neurow && docker build .
- run: |
cd neurow
docker build . -t neurow:${{ github.sha }}
Copy link
Contributor

@achouippe achouippe Oct 4, 2024

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)

Copy link
Member Author

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).

Copy link
Member Author

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.

@papey papey merged commit 1be0c39 into main Oct 4, 2024
4 checks passed
@papey papey deleted the add-curl-check-before-pushing-image branch October 4, 2024 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants