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: Distribute as docker image #1875

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

mircea-pavel-anton
Copy link

@mircea-pavel-anton mircea-pavel-anton commented Oct 21, 2024

This is currently a WIP to solve #1801

Some notes

  • I chose debian as a base for the docker image instead of alpine, for example, such that I can load the bash completion

  • I set the workdir to /workspace to facilitate mounting volumes into the container via ad-hoc docker commands, i.e.:

    docker run -it -v $PWD:/workspace ghcr.io/go-task/task:v3.39.2-amd64 lint # equivalent of `task lint`
  • I set the cmd instead of the entrypoint to the task executable such that it is easier to just exec into the container like so:

    docker run -it -v $PWD:/workspace ghcr.io/go-task/task:v3.39.2-amd64 /bin/bash
  • the current implementation pushes both to dockerhub and ghcr.io

  • the current implementation pushes:

    • version tagged images (ghcr.io/go-task/task:v3.39.2)
    • version and arch tagged images (ghcr.io/go-task/task:v3.39.2-amd64)
    • latest images (ghcr.io/go-task/task:latest)

TODO

  • update release workflow to login to ghcr and/or dockerhub
  • figure out bash completion

@mircea-pavel-anton
Copy link
Author

@pd93 @andreynering

What do you think about this implementation?

I moved to using scratch as a base for the image and put in only the binary and the shell completions so that they can both be easily imported.

I also added some documentation about the changes, though I decided to keep it rather minimal. Not sure about the Note section. I'm open to suggestions.

I also modified the goreleaser to only push to GHCR (initially it was configured to push to docker.io as well).

P.S. Ignore the devcontainer file, that was only for my local testing. I will drop that commit once this PR is ready

@mircea-pavel-anton mircea-pavel-anton marked this pull request as ready for review December 7, 2024 14:09
Copy link
Member

@pd93 pd93 left a comment

Choose a reason for hiding this comment

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

We should probably also add additional tags for latest, 3, 3.40 etc.

.goreleaser.yml Outdated
use: buildx
dockerfile: Dockerfile
extra_files:
- completion/bash/task.bash
Copy link
Member

Choose a reason for hiding this comment

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

Direct usage of these files is deprecated.

Copy link
Author

@mircea-pavel-anton mircea-pavel-anton Dec 8, 2024

Choose a reason for hiding this comment

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

Oh damn, I completely missed that. Will fix!

FWIW, they still seem to be referenced throughout the goreleaser config. If I understand correctly, the brew installer also uses them as well as the nfpms?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah unfortunately, they are still used in a few places. This is why we deprecated them instead of removing them. We need to slowly remove the references to them. We could probably still add completions to the image by writing a .bashrc during the build and using the new method

Copy link
Author

Choose a reason for hiding this comment

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

I thought about generating the completions in the container, but then I decided against it.

It doesn't make much sense to generate the bash completions given the image is based on scratch IMHO, and even then, if we generate and include one set of completions we might as well generate all.

I think that, given the completions can be generated from the binary, it is just as simple to add a RUN command in your dockerfile to set up your required completions.

There are already instructions for generating the completions so that should have it covered. At the end of the day, the container image is a means to distribute the binary, right?

Let me know what you think!

Copy link
Member

@andreynering andreynering left a comment

Choose a reason for hiding this comment

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

Haven't attempted to build it yet, but added some comments for now.

.devcontainer/devcontainer.json Outdated Show resolved Hide resolved
.goreleaser.yml Outdated Show resolved Hide resolved
.goreleaser.yml Outdated Show resolved Hide resolved
.goreleaser.yml Outdated Show resolved Hide resolved
.goreleaser.yml Outdated Show resolved Hide resolved
.goreleaser.yml Outdated Show resolved Hide resolved
website/docs/installation.mdx Outdated Show resolved Hide resolved
website/docs/installation.mdx Outdated Show resolved Hide resolved
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