Skip to content

Containerise dependencies required to run tasks in dev workflow #53

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

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

Conversation

banjoh
Copy link
Member

@banjoh banjoh commented Apr 25, 2025

  • Add tasks to manage container dev environment
  • Update documentation to reflect new list of requirements
  • CI job to build and publish ghcr.io/replicatedhq/platform-examples/wg-easy-tools:latest image. The image is also tagged with sha-<commit>.

Copy link
Member

@chris-sanders chris-sanders left a comment

Choose a reason for hiding this comment

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

I started to call out everywhere that there is 'docker' and then realized you've labeled that as 'to follow' so I stopped since that's still wip.

# GCP default configuration
GCP_PROJECT: '{{.GCP_PROJECT | default "replicated-qa"}}'
GCP_ZONE: '{{.GCP_ZONE | default "us-central1-a"}}'
VM_NAME: '{{.VM_NAME | default (printf "%s-dev" (or (env "GUSER") "user"))}}'

# Docker workflow configuration
IMAGE_NAME: ttl.sh/wg-easy-dev
Copy link
Member

Choose a reason for hiding this comment

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

We really shouldn't be using ttl.sh here, it's fine for development but it needs to be available somewhere else for the actual workflow. Is this currently just for you to test and you intend to move it later?

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 is currently for test until we decide on

  • if we need to host this image. We need to weigh the need to host the image vs users needing to build the image which take a minute.
  • what OCI registry - docker hub? replicated? all of the above?

Copy link
Member

Choose a reason for hiding this comment

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

Can we build the image and have it pushed to ghcr.io right here on this repo?
I'm fine with starting with a local build and following up with the auto-build on ghcr or if it's easy enough just build it anytime the Containerfile changes on merge to main.

I added a podman based image build/push on troubleshoot-mcp-server which might be very close to what you would need. https://github.com/chris-sanders/troubleshoot-mcp-server/blob/main/.github/workflows/publish-container.yaml

sudo \

# Install Helm
&& curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash \
Copy link
Member

Choose a reason for hiding this comment

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

Why is this all one big RUN line?
Doesn't this mean that you're forcing the cache to be invalidated if any of these things change rather than only updating the one change? Is there a benefit to it b/c I only see a downside of breaking normal caching behavior.

Copy link
Member Author

Choose a reason for hiding this comment

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

Since we are not specifying any tool versions, would any of these tools change, leading to the layer being recreated? To update the tool versions, wouldn't it require docker build --no-cache anyway?

One, though negligible difference is the overall image size. Its smaller when using one layer. 1.23GB vs 1.18GB

Copy link
Member

Choose a reason for hiding this comment

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

The image size I believe is driven exclusively off the fact that you include && rm -rf /var/lib/apt/lists/* in the same RUN command as the apt install and that I'm aware of and fine with.

What I don't think you need to be doing is mixing apt and curl installs. Using all of the apt installs in a single RUN and ending it with the cleanup is good practice. Grouping independent curl commands inside of an apt RUN command is what I would break up here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've split the RUN directives to separate debian package installs and downloading tools

@banjoh banjoh changed the title Dockerise dependencies required to run tasks in dev workflow Containerise dependencies required to run tasks in dev workflow Apr 28, 2025
Copy link
Member

@chris-sanders chris-sanders left a comment

Choose a reason for hiding this comment

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

A few more comments / questions / changes

Comment on lines 17 to 25
start:
desc: Start development container in background
silent: true
cmds:
- task: start-implementation

# Start development container in background.
# It's internal because it's used by shell and start tasks.
start-implementation:
Copy link
Member

Choose a reason for hiding this comment

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

I'm not following why can't this all just be in the "start" task? Task can call and require each other what does having an internal task buy you here if the real start task is just calling the internal one anyway?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've DRY'd this bit some more

Copy link

@scottrigby scottrigby left a comment

Choose a reason for hiding this comment

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

a few more suggestions

@banjoh banjoh force-pushed the em/dockerize-wg-easy-dependencies branch from 41ab16e to 3c23789 Compare April 29, 2025 13:44
banjoh added 5 commits April 29, 2025 14:44
Signed-off-by: Evans Mungai <[email protected]>
Signed-off-by: Evans Mungai <[email protected]>
Signed-off-by: Evans Mungai <[email protected]>
Signed-off-by: Evans Mungai <[email protected]>
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