with base src/

This commit is contained in:
Kasper Juul Hermansen 2022-10-29 23:06:06 +02:00
parent 5b43195fef
commit dfa693ea08
Signed by: kjuulh
GPG Key ID: 0F95C140730F2F23
3 changed files with 5 additions and 23 deletions

View File

@ -8,7 +8,7 @@ RUN go build -o dist/dagger-go main.go
FROM harbor.front.kjuulh.io/docker-proxy/library/docker:dind FROM harbor.front.kjuulh.io/docker-proxy/library/docker:dind
WORKDIR /src/docker WORKDIR /src
COPY --from=builder /src/builder/dist/dagger-go /usr/bin/ COPY --from=builder /src/builder/dist/dagger-go /usr/bin/

View File

@ -16,9 +16,9 @@ steps:
- "sleep 5" - "sleep 5"
- apk add git - apk add git
- mkdir -p tmp/dagger-go - mkdir -p tmp/dagger-go
- git clone "https://git.front.kjuulh.io/kjuulh/dagger-go.git" tmp/dagger-go - git clone "https://git.front.kjuulh.io/kjuulh/dagger-go.git" /mnt/dagger-go
- docker build -t dagger-go-builder:${DRONE_COMMIT} -f tmp/dagger-go/Dockerfile . - docker build -t dagger-go-builder:${DRONE_COMMIT} -f mnt/dagger-go/Dockerfile .
- 'docker run -v "$PWD/:/src/build" -v /var/run/docker.sock:/var/run/docker.sock dagger-go-builder:${DRONE_COMMIT} dagger-go build --image-tag "{{ or .input.imageTag $imageTag }}"' - 'docker run -v "$PWD/:/src" -v /var/run/docker.sock:/var/run/docker.sock dagger-go-builder:${DRONE_COMMIT} dagger-go build --image-tag "{{ or .input.imageTag $imageTag }}"'
services: services:
- name: docker - name: docker

View File

@ -31,24 +31,6 @@ func Build(builder *internal.Builder, imageTag string) error {
return err return err
} }
log.Println("listing files in /src/build")
dir, err := os.ReadDir("/src/build")
if err == nil {
for _, d := range dir {
log.Printf("content: %s\n", d.Name())
}
} else {
return err
}
log.Println("listing files in /src/docker")
dir, err = os.ReadDir("/src/docker")
if err == nil {
for _, d := range dir {
log.Printf("content: %s\n", d.Name())
}
}
log.Println("listing files in /src/") log.Println("listing files in /src/")
dir, err = os.ReadDir("/src/") dir, err = os.ReadDir("/src/")
if err == nil { if err == nil {
@ -58,7 +40,7 @@ func Build(builder *internal.Builder, imageTag string) error {
} }
golang := client.Container().From("golang:latest") golang := client.Container().From("golang:latest")
golang = golang.WithMountedDirectory("/src/build", src).WithWorkdir("/src") golang = golang.WithMountedDirectory("/src", src).WithWorkdir("/src")
_, err = golang.Exec(dagger.ContainerExecOpts{ _, err = golang.Exec(dagger.ContainerExecOpts{
Args: []string{"go", "build", "-o", "build/"}, Args: []string{"go", "build", "-o", "build/"},
}).ExitCode(ctx) }).ExitCode(ctx)