Skip to content

Install as a Docker CLI plugin #48

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

Merged
merged 3 commits into from
Sep 30, 2024

Conversation

eugencowie
Copy link
Contributor

@eugencowie eugencowie commented Aug 21, 2024

What does this change?

Installs the docker-compose binary to /usr/local/lib/docker/cli-plugins/ and symlinks /usr/local/bin/docker-compose to the new location. This allows using either docker compose or docker-compose in scripts. The motivation for this change is detailed in #47.

What issue does it fix?

Closes #47

Notes for the reviewer

I've tested this locally with the examples in the repo and my own bundle, it doesn't break the mixin commands nor scripts which use the docker-compose command.

curl -fL "https://github.com/docker/compose/releases/download/v%s/docker-compose-linux-x86_64" -o /usr/local/bin/docker-compose && \
chmod +x /usr/local/bin/docker-compose`, dockerComposeVersion)
curl -fL "https://github.com/docker/compose/releases/download/v%s/docker-compose-linux-x86_64" -o /usr/local/lib/docker/cli-plugins/docker-compose --create-dirs && \
chmod +x /usr/local/lib/docker/cli-plugins/docker-compose && \
Copy link
Member

Choose a reason for hiding this comment

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

Why ln over setting it in -o, just generally curious

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has changed slightly after merging the latest from main and fixing the conflicts. Initially, I updated it to use ADD to download the file and then RUN ln -s to create the symlink (63bfacc). However, after doing that, it occurred to me that instead of creating a symlink in /usr/local/bin, we could just update the PATH:

ADD --chmod=755 https://github.com/docker/compose/releases/download/v%s/docker-compose-linux-x86_64 /usr/local/lib/docker/cli-plugins/docker-compose
ENV PATH="$PATH:/usr/local/lib/docker/cli-plugins"

This seems like a nicer way of ensuring that docker-compose can still be used. I've tested and pushed that change up, but could revert to using a symlink or just installing the binary into both folders, whichever you think is cleaner.

Thanks for the review!

@kichristensen kichristensen self-requested a review September 27, 2024 18:49
@schristoff schristoff merged commit da23a6b into getporter:main Sep 30, 2024
2 checks passed
@eugencowie eugencowie deleted the docker-cli-plugin branch September 30, 2024 23:58
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.

Install as a Docker CLI plugin
3 participants