Merge pull request #2115 from NotTheEconomist/patch-2114

universe: python: allow custom path to python
This commit is contained in:
Helder Correia 2022-04-12 22:26:12 +00:00 committed by GitHub
commit a56a29c6d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View File

@ -42,7 +42,7 @@ import (
docker.#Run & { docker.#Run & {
command: { command: {
name: "python3" name: string | *"python3"
"args": ["\(_mountpoint)/\(script._filename)"] + args "args": ["\(_mountpoint)/\(script._filename)"] + args
} }

View File

@ -3,13 +3,28 @@ package python
import ( import (
"dagger.io/dagger" "dagger.io/dagger"
"dagger.io/dagger/core" "dagger.io/dagger/core"
"universe.dagger.io/docker"
"universe.dagger.io/python" "universe.dagger.io/python"
) )
dagger.#Plan & { dagger.#Plan & {
actions: test: { 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 // Run a script from source directory + filename
runFile: { runFile: {