#hi all i have a question i m trying to

1 messages ยท Page 1 of 1 (latest)

flint wedge
#

This kind of thing?

FROM alpine

ARG greeting_name

RUN echo "Hello, $greeting_name"

docker build --build-arg greeting_name=Jeremy .

umbral plinth
#

Yes like that, but translate it to be used with a dagger plan

#

I see that docker.#Build has an option buildArg but it seems to only take a string

flint wedge
#

I see that docker.#Build has an option buildArg but it seems to only take a string
It takes strings with labels that are also strings ([string]). It's a template thing.

If you want to keep your Dockerfile and set the BuildArgs in Dagger, you can do something like this:

FROM alpine

ARG greeting_name
ARG time_of_day

RUN echo "Hello, $greeting_name, good $time_of_day"
package main

import (
  "dagger.io/dagger"
  "universe.dagger.io/docker"

)

dagger.#Plan & {
  client: filesystem: ".": read: contents: dagger.#FS

  actions: {
    build: docker.#Dockerfile & {
      source: client.filesystem.".".read.contents
      buildArg: {
        greeting_name: "Jeremy"
        time_of_day:   "afternoon"
      }
    }
  }
}

dagger do build --log-format plain --no-cache

#

I threw the --no-cache on there so you'd be sure to see the greeting output in the logs. Without it, you'll get caching which is prob what you want for fast builds ๐Ÿ™‚

flint wedge
umbral plinth
#

thank you! i love this tool and how easy it is to use

#

are there is plans to integrate dagger with cosign?

#

as a step/plan, i mean

flint wedge
umbral plinth
#

it would be a great option to do this, how does one get started to add it as a package?

flint wedge
#

All is takes is a PR to https://github.com/dagger/dagger/tree/main/pkg/universe.dagger.io/alpha ๐Ÿ˜‰

The package would install cosign (using process here: https://github.com/sigstore/cosign) in a container (perhaps alpine) and will want two secrets (dagger.#Secret): private signing key and password for the key.

It would likely then take in an image (dagger.Image) so you could use it as part of your build: build an image and then sign it.

Easy way to store the secrets for testing purposes is to use sops and an AGE key. We do that for the secrets for testing all of the Dagger Universe packages:
https://github.com/dagger/dagger/blob/main/pkg/universe.dagger.io/secrets_sops.yaml
https://github.com/dagger/dagger/blob/main/pkg/universe.dagger.io/age_key.txt

e.g. Netlify https://github.com/dagger/dagger/blob/main/pkg/universe.dagger.io/netlify/test/test.cue#L14-L29