universe: python: allow custom path to python
Closes #2114 Signed-off-by: Adam Smith <adamsmith@nottheeconomist.com>
This commit is contained in:
parent
e110ac05a2
commit
975413e793
@ -42,7 +42,7 @@ import (
|
||||
|
||||
docker.#Run & {
|
||||
command: {
|
||||
name: "python3"
|
||||
name: string | *"python3"
|
||||
"args": ["\(_mountpoint)/\(script._filename)"] + args
|
||||
}
|
||||
|
||||
|
@ -3,13 +3,28 @@ package python
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/core"
|
||||
|
||||
"universe.dagger.io/docker"
|
||||
"universe.dagger.io/python"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
actions: test: {
|
||||
|
||||
// Run with a custom path to python
|
||||
customPath: {
|
||||
|
||||
// python:3.10-alpine has both python3 and python in the PATH
|
||||
_image: docker.#Pull & {
|
||||
source: "python:3.10-alpine"
|
||||
}
|
||||
run: python.#Run & {
|
||||
input: _image.output
|
||||
command: name: "python"
|
||||
script: contents: #"print("Hello, world!")"#
|
||||
}
|
||||
// This needs no output test because it is only testing that the command runs
|
||||
}
|
||||
|
||||
// Run a script from source directory + filename
|
||||
runFile: {
|
||||
|
||||
|
Reference in New Issue
Block a user