diff --git a/.drone.yml b/.drone.yml index 7f16203..92c7f33 100644 --- a/.drone.yml +++ b/.drone.yml @@ -19,7 +19,7 @@ steps: - sleep 10 - echo "$DOCKER_PASSWORD" | docker login --password-stdin --username="$DOCKER_USERNAME" - name: "build" - image: docker.io/kasperhermansen/shuttle-drone:1683322851258 + image: docker.io/kasperhermansen/shuttle-drone:1683325143197 volumes: - name: dockersock path: /var/run diff --git a/actions/build.go b/actions/build.go index 4dd56ef..b3a616b 100644 --- a/actions/build.go +++ b/actions/build.go @@ -83,12 +83,21 @@ func Build(ctx context.Context) error { WithExec([]string{ "apt", "install", "-y", "curl", "build-essential", }). + WithEnvVariable("RUSTUP_HOME", "/usr/local/rustup"). + WithEnvVariable("CARGO_HOME", "/usr/local/cargo"). WithExec([]string{ "bash", "-c", "curl https://sh.rustup.rs -sSf | bash -s -- -y", - }). - WithExec([]string{ - "bash", "-c", "echo 'source $HOME/.cargo/env' >> $HOME/.bashrc", - }). + }) + + path, err := image.EnvVariable(ctx, "PATH") + if err != nil { + return err + } + + image = image. + WithEnvVariable( + "PATH", fmt.Sprintf("/usr/local/cargo/bin:%s", path), + ). WithWorkdir("/app"). WithFile("/usr/local/bin/shuttle", shuttle). WithExec([]string{"shuttle", "version"}) @@ -97,6 +106,11 @@ func Build(ctx context.Context) error { return err } + if _, err := image.WithExec([]string{"cargo", "--version"}).ExitCode(ctx); err != nil { + log.Printf("%v", err) + return err + } + image = image.WithFile("/usr/bin/docker", docker) if _, err := image.ExitCode(ctx); err != nil { log.Printf("%v", err)