#hi all i have a question i m trying to
1 messages ยท Page 1 of 1 (latest)
This kind of thing?
FROM alpine
ARG greeting_name
RUN echo "Hello, $greeting_name"
docker build --build-arg greeting_name=Jeremy .
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
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 ๐
You could also read the those buildArgs as environment variables set on the client.
https://docs.dagger.io/1203/client/#environment-variables
Lots of options, really.
You can also convert your Dockerfile into Dagger, if that makes deps, multi-stage, etc easier ๐
Lot's of great ideas here: https://docs.dagger.io/1241/docker
The universe.dagger.io module is meant to provide higher level abstractions on top of core actions. Of these, the universe.dagger.io/docker package provides a general base for building and running docker images.
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
We did have one user working on that...
https://github.com/sigstore/cosign
It would be great to have it as a package in Dagger Universe:
- Universe stable: https://github.com/dagger/dagger/tree/main/pkg/universe.dagger.io
- Universe alpha: https://github.com/dagger/dagger/tree/main/pkg/universe.dagger.io/alpha
it would be a great option to do this, how does one get started to add it as a package?
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
Speaking of PRs. It would be great if you could PR your npm-ified version of the package that started as yarn to https://github.com/dagger/dagger/tree/main/pkg/universe.dagger.io/alpha/npm ๐