Skip to content

Instantly share code, notes, and snippets.

@bardic
Last active December 14, 2024 16:17
Show Gist options
  • Select an option

  • Save bardic/2448ac0667622141aadb6975fc86d3fc to your computer and use it in GitHub Desktop.

Select an option

Save bardic/2448ac0667622141aadb6975fc86d3fc to your computer and use it in GitHub Desktop.
dagger ijhttp example
func (i *Integration) Test(server, test *dagger.Directory) (string, error) {
serverService := dag.Container().
From("golang:latest").
WithDirectory("/src", server).
WithExposedPort(1323).
WithWorkdir("/src/server").
WithExec([]string{"go", "run", "main.go"}).
AsService()
return dag.Container().
From("alpine:latest").
WithDirectory("/workdir", test).
WithExec([]string{"apk", "add", "openjdk17-jdk", "curl", "unzip"}).
WithExec([]string{"/bin/sh", "-c", "mkdir /ijhttp"}).
WithExec([]string{"curl", "-f", "-L", "-o", "/ijhttp/ijhttp.zip", "https://jb.gg/ijhttp/latest"}).
WithExec([]string{"unzip", "/ijhttp/ijhttp.zip"}).
WithExec([]string{"/bin/sh", "-c", "chmod +x /ijhttp/ijhttp"}).
WithServiceBinding("server", serverService).
WithExec([]string{"sh", "/ijhttp/ijhttp", "/workdir/test.http"}).
Stdout(context.Background())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment