dapr / cli

Command-line tools for Dapr.
Apache License 2.0
318 stars 202 forks source link

Dapr CLI Docker Image #1339

Closed mindovermiles262 closed 1 year ago

mindovermiles262 commented 1 year ago

Description

This PR adds a workflow to publish Dapr CLI to docker hub when there is a new release. This PR will require help with a few things from Maintainers:

Issue reference

None

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

shubham1172 commented 1 year ago

Hi @mindovermiles262, since Dapr CLI is a self-contained binary available for all platforms, what is the purpose for having a docker image?

mindovermiles262 commented 1 year ago

I have a use case where I want to run a job on my kubernetes cluster using dapr cli. Something like:

apiVersion: batch/v1
kind: Job
metadata:
  name: dapr-cli
spec:
  template:
    spec:
      containers:
      - name: dapr-cli
        image: daprio/cli
        command: ["dapr", "..."]

I did a quick search but couldn't find any existing image with dapr-cli already installed.

shubham1172 commented 1 year ago

@mindovermiles262 how about a workaround like the following?

apiVersion: batch/v1
kind: Job
metadata:
  name: dapr-cli
spec:
  template:
    spec:
      containers:
      - name: dapr-container
        image: alpine:latest  # Maybe try distroless if not alpine, commands below are roughly written
        command:
          - "/bin/sh"
          - "-c"
          - |
            apk add --update --no-cache curl
            curl -fsSL https://raw.githubusercontent.com/dapr/cli/master/install/install.sh | /bin/sh # or you can simply wget the binary
            dapr command
      restartPolicy: Never
  backoffLimit: 1
mindovermiles262 commented 1 year ago

Sure, that would work, but it seems like the cli should be available as a container

shubham1172 commented 1 year ago

Sure, that would work, but it seems like the cli should be available as a container

If there are more use-cases or requirements from the community I'd be happy to vote in favor. For one specific use case it might be an overkill to maintain yet another GitHub pipeline and have yet another Docker image (which will support a single platform - linux/amd64 as per this PR).

^Just my opinion, maintainers might have something else to add.

mindovermiles262 commented 1 year ago

Fair enough. Let me move this to an Issue for future reference. Thanks