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/docs/tests/core-concepts/container-images/simple/build.cue
Solomon Hykes 26cbc7dc68 Docs: add content to 1205: "building container images"
Signed-off-by: Solomon Hykes <solomon@dagger.io>
2022-04-06 22:49:03 +00:00

48 lines
845 B
CUE

package main
import (
"dagger.io/dagger"
"universe.dagger.io/docker"
)
// This action builds a docker image from a python app.
// Build steps are defined in native CUE.
#PythonBuild: {
// Source code of the Python application
app: dagger.#FS
// Container image
image: _build.output
// Build steps
_build: docker.#Build & {
steps: [
docker.#Pull & {
source: "python:3.9"
},
docker.#Copy & {
contents: app
dest: "/app"
},
docker.#Run & {
command: {
name: "pip"
args: ["install", "-r", "/app/requirements.txt"]
}
},
docker.#Set & {
config: cmd: ["python", "/app/app.py"]
},
]
}
}
// Example usage in a plan
dagger.#Plan & {
client: filesystem: "./src": read: contents: dagger.#FS
actions: build: #PythonBuild & {
app: client.filesystem."./src".read.contents
}
}