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

Embed serve as default command to run the server container #947

Merged
merged 3 commits into from
Mar 14, 2024

Conversation

haoming29
Copy link
Contributor

Closes #945

@haoming29 haoming29 requested a review from matyasselmeci March 14, 2024 15:10
@haoming29 haoming29 added critical High priority for next release container labels Mar 14, 2024
Copy link
Contributor

@brianhlin brianhlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you specify the CMD instead of appending this to ENTRYPOINT, you'll get the default behavior we want but still allow people to specify other commands when starting the container. See https://docs.docker.com/reference/dockerfile/#cmd

Also, I /think/ you could do this in the final-stage layer so that you don't have to repeat it across every single one of the separated images

@haoming29 haoming29 requested a review from brianhlin March 14, 2024 17:04
@haoming29
Copy link
Contributor Author

haoming29 commented Mar 14, 2024

@brianhlin I ended up doing ENTRYPOINT [ "/entrypoint.sh" ,"pelican", "director"] with CMD ["serve"] so that users only need to specify serve [args...] if they prefer running other command.

I didn't think of a way to put ENTRYPOINT into final-stage as the entrypoint has the server name attached and that's what distinguish different server images right?

@brianhlin
Copy link
Contributor

@brianhlin I ended up doing ENTRYPOINT [ "/entrypoint.sh" ,"pelican", "director"] with CMD ["serve"] so that users only need to specify serve [args...] if they prefer running other command.

I think this limits your flexibility a bit too much, though I'll admit that I'm not too familiar with each host's commands other than serve or token. I don't think it's too much to ask users to specify serve <additional options> if they want to do something outside of the defaults.

I didn't think of a way to put ENTRYPOINT into final-stage as the entrypoint has the server name attached and that's what distinguish different server images right?

Yeah, that's one benefit of putting the serve in the CMD instead so that you could have per-image ENTRYPOINT but a shared default CMD

@haoming29
Copy link
Contributor Author

I don't think it's too much to ask users to specify serve <additional options> if they want to do something outside of the defaults.

Oops. This is what I did lol. I meant that if I only put ENTRYPOINT [ "/entrypoint.sh"] with CMD ["pelican", "director", "serve"], then users must specify pelican director serve -p xxx for additional arguments

@haoming29
Copy link
Contributor Author

Yeah, that's one benefit of putting the serve in the CMD instead so that you could have per-image ENTRYPOINT but a shared default CMD

That makes sense. Will do!

@haoming29
Copy link
Contributor Author

OK so I figured that if I have CMD set prior to ENTRYPOINT, it is ignored. So I have put to CMD in each product-stage. But I do removed WORKDIR from product-stage

Copy link
Contributor

@brianhlin brianhlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK so I figured that if I have CMD set prior to ENTRYPOINT

Ah bummer! This LGTM, though

@haoming29 haoming29 merged commit 258ba5a into PelicanPlatform:main Mar 14, 2024
16 of 18 checks passed
@haoming29 haoming29 deleted the add-cmd-to-prod-container branch March 14, 2024 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
container critical High priority for next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default container run command to include serve
2 participants