with base src/
This commit is contained in:
parent
5b43195fef
commit
dfa693ea08
@ -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/
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user