feat: update with proper rust
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Kasper Juul Hermansen 2023-05-06 00:22:04 +02:00
parent 9f6acb0f13
commit 0e914322f4
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912
2 changed files with 19 additions and 5 deletions

View File

@ -19,7 +19,7 @@ steps:
- sleep 10 - sleep 10
- echo "$DOCKER_PASSWORD" | docker login --password-stdin --username="$DOCKER_USERNAME" - echo "$DOCKER_PASSWORD" | docker login --password-stdin --username="$DOCKER_USERNAME"
- name: "build" - name: "build"
image: docker.io/kasperhermansen/shuttle-drone:1683322851258 image: docker.io/kasperhermansen/shuttle-drone:1683325143197
volumes: volumes:
- name: dockersock - name: dockersock
path: /var/run path: /var/run

View File

@ -83,12 +83,21 @@ func Build(ctx context.Context) error {
WithExec([]string{ WithExec([]string{
"apt", "install", "-y", "curl", "build-essential", "apt", "install", "-y", "curl", "build-essential",
}). }).
WithEnvVariable("RUSTUP_HOME", "/usr/local/rustup").
WithEnvVariable("CARGO_HOME", "/usr/local/cargo").
WithExec([]string{ WithExec([]string{
"bash", "-c", "curl https://sh.rustup.rs -sSf | bash -s -- -y", "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"). WithWorkdir("/app").
WithFile("/usr/local/bin/shuttle", shuttle). WithFile("/usr/local/bin/shuttle", shuttle).
WithExec([]string{"shuttle", "version"}) WithExec([]string{"shuttle", "version"})
@ -97,6 +106,11 @@ func Build(ctx context.Context) error {
return err 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) image = image.WithFile("/usr/bin/docker", docker)
if _, err := image.ExitCode(ctx); err != nil { if _, err := image.ExitCode(ctx); err != nil {
log.Printf("%v", err) log.Printf("%v", err)