#How do I view the output of bash command

1 messages ยท Page 1 of 1 (latest)

green rain
#
package dbt

import (
    "dagger.io/dagger"
    "universe.dagger.io/bash" // import this package to execute bash commands inside a docker container
    "universe.dagger.io/docker" // import this package to set up docker
)

dagger.#Plan & {
    // configure the client so that dagger takes only the files it needs
    client: filesystem: "./": read: {
        contents: dagger.#FS
        exclude: [
            "README.md",
            "ci.cue",
            "Vagrantfile",
            "target/",
            ".vagrant/",
        ]
    }    

    actions: {
        // copy contents of repo  
        deps: docker.#Build & {
            steps: [
                docker.#Pull & {
                    source: "python:3.9.11"
                },
                docker.#Copy & {
                    contents: client.filesystem."./".read.contents
                    dest:     "/app"
                },
            
            ]
        }
        // print python version 
        version: bash.#Run & {
            input:   deps.output
            workdir: "/app"
            script: contents: #"""
                echo python --version
                """#
        }
    }

}

I would like to see the Python version printed to the terminal.

arctic lodge
#

Hello ๐Ÿ‘‹ @green rain

#

The only issue with your plan is that you're not executing python, but echoing the string "python --version"

#

Remove the echo and run like this dagger do version --log-format plain and you'll see your expected output

#

๐Ÿ™‚