This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/pkg/universe.dagger.io/examples/changelog.com/highlevel/elixir/mix/mix.cue

96 lines
1.7 KiB
CUE
Raw Normal View History

package mix
import (
"dagger.io/dagger"
"dagger.io/dagger/engine"
"universe.dagger.io/docker"
)
// Build an Elixir application with Mix
#Build: {
// Ref to base image
// FIXME: spin out docker.#Build for max flexibility
// Perhaps implement as a custom docker.#Build step?
base: docker.#Ref
// App name (for cache scoping)
app: string
// Mix environment
env: string
// Application source code
source: dagger.#FS
docker.#Build & {
steps: [
// 1. Pull base image
docker.#Pull & {
source: base
},
// 2. Copy app source
docker.#Copy & {
contents: source
dest: "/app"
},
// 3. Download dependencies into deps cache
#Run & {
mix: {
"env": env
"app": app
depsCache: "locked"
}
workdir: "/app"
script: "mix deps.get"
},
// 4. Build!
// FIXME: step 5 is to add image data, see issue 1339
#Run & {
mix: {
"env": env
"app": app
depsCache: "private"
buildCache: "locked"
}
workdir: "/app"
script: "mix do deps.compile, compile"
},
]
}
}
// Run mix correctly in a container
#Run: {
mix: {
app: string
env: string
// FIXME: "ro" | "rw"
depsCache?: "private" | "locked"
buildCache?: "private" | "locked"
}
docker.#Run
env: MIX_ENV: mix.env
Make changelog.com highlevel Europa run We fixed a few issues with @shykes & @jlongtine, and @talentedmrjones gave us this great command to run: cd pkg/universe.dagger.io/examples/changelog.com/highlevel dagger up --europa ./gerhard --log debug --log-format plain 7:42PM DBG system | detected buildkit config haveHostNetwork=true isActive=true version=v0.9.3 7:42PM DBG system | loading plan args=[ "./gerhard/" ] 7:42PM DBG system | vendoring packages mod=/Users/gerhard/github.com/gerhard/dagger/pkg/universe.dagger.io 7:42PM DBG system | spawning buildkit job attrs=null localdirs={ "/Users/gerhard/github.com/thechangelog/changelog.com/": "/Users/gerhard/github.com/thechangelog/changelog.com" } 7:42PM INF actions.test.db.pull._op | computing 7:42PM INF actions.test.run._exec | computing 7:42PM INF inputs.directories.app | computing 7:42PM INF actions.dev.build._dag."0"._op | computing 7:42PM INF actions.test.build._dag."0"._op | computing 7:42PM ERR actions.test.run._exec | failed: invalid FS at path "actions.test.run._exec.input": FS is not set duration=0s 7:42PM DBG inputs.directories.app | loading local directory path=/Users/gerhard/github.com/thechangelog/changelog.com/ 7:42PM ERR actions.dev.build._dag."0"._op | canceled duration=0s 7:42PM ERR actions.test.db.pull._op | canceled duration=0s 7:42PM ERR actions.test.build._dag."0"._op | canceled duration=0s 7:42PM ERR inputs.directories.app | canceled duration=0s 7:42PM FTL system | failed to up environment: task failed: actions.test.run._exec: invalid FS at path "actions.test.run._exec.input": FS is not set The next step is to figure out why this is failing @jlongtine. Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2022-01-21 20:49:28 +01:00
workdir: string
{
mix: depsCache: string
mounts: depsCache: {
contents: engine.#CacheDir & {
id: "\(mix.app)_deps"
concurrency: mix.depsCache
}
dest: "\(workdir)/deps"
}
} | {}
{
mix: buildCache: string
mounts: buildCache: {
contents: engine.#CacheDir & {
id: "\(mix.app)_deps"
concurrency: mix.buildCache
}
dest: "\(workdir)/deps"
}
} | {}
}