diff --git a/Dockerfile b/Dockerfile index 589136a0..aa29228c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,14 @@ FROM alpine:3.15 -RUN apk add --no-cache ca-certificates e2fsprogs xfsprogs blkid xfsprogs-extra e2fsprogs-extra btrfs-progs cryptsetup + +RUN apk add --no-cache \ + blkid \ + btrfs-progs \ + ca-certificates \ + cryptsetup \ + e2fsprogs \ + e2fsprogs-extra \ + xfsprogs \ + xfsprogs-extra + COPY ./controller.bin /bin/hcloud-csi-driver-controller COPY ./node.bin /bin/hcloud-csi-driver-node diff --git a/deploy/docker-swarm/pkg/Dockerfile b/deploy/docker-swarm/pkg/Dockerfile index 8a39e36d..7b13659f 100644 --- a/deploy/docker-swarm/pkg/Dockerfile +++ b/deploy/docker-swarm/pkg/Dockerfile @@ -1,15 +1,30 @@ FROM --platform=$TARGETPLATFORM golang:1.21 as builder -WORKDIR /csi -ADD go.mod go.sum /csi/ + +WORKDIR /build + +ADD go.mod go.sum /build/ RUN go mod download -ADD . /csi/ + +ADD . /build/ RUN ls -al -RUN CGO_ENABLED=0 go build -o aio.bin github.com/hetznercloud/csi-driver/cmd/aio + +ARG CGO_ENABLED=0 +RUN go build -o aio.bin github.com/hetznercloud/csi-driver/cmd/aio FROM --platform=$TARGETPLATFORM alpine:3.15 -RUN apk add --no-cache ca-certificates e2fsprogs xfsprogs blkid xfsprogs-extra e2fsprogs-extra btrfs-progs cryptsetup + +RUN apk add --no-cache \ + blkid \ + btrfs-progs \ + ca-certificates \ + cryptsetup \ + e2fsprogs \ + e2fsprogs-extra \ + xfsprogs \ + xfsprogs-extra + ENV GOTRACEBACK=all RUN mkdir -p /plugin -COPY --from=builder /csi/aio.bin /plugin +COPY --from=builder /build/aio.bin /plugin ENTRYPOINT [ "/plugin/aio.bin" ] diff --git a/hack/Dockerfile b/hack/Dockerfile index eb3b0965..3a31dc06 100644 --- a/hack/Dockerfile +++ b/hack/Dockerfile @@ -1,16 +1,34 @@ FROM golang:1.21 as builder -WORKDIR /csi -ADD go.mod go.sum /csi/ + +WORKDIR /build + +ADD go.mod go.sum /build/ RUN go mod download -ADD . /csi/ + +ADD . /build/ RUN ls -al + +ARG GOOS=linux +ARG GOARCH=amd64 +ARG CGO_ENABLED=0 # `skaffold debug` sets SKAFFOLD_GO_GCFLAGS to disable compiler optimizations ARG SKAFFOLD_GO_GCFLAGS -RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -gcflags="${SKAFFOLD_GO_GCFLAGS}" -o controller.bin github.com/hetznercloud/csi-driver/cmd/controller -RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -gcflags="${SKAFFOLD_GO_GCFLAGS}" -o node.bin github.com/hetznercloud/csi-driver/cmd/node + +RUN go build -gcflags="$SKAFFOLD_GO_GCFLAGS" -o controller.bin github.com/hetznercloud/csi-driver/cmd/controller +RUN go build -gcflags="$SKAFFOLD_GO_GCFLAGS" -o node.bin github.com/hetznercloud/csi-driver/cmd/node FROM alpine:3.15 -RUN apk add --no-cache ca-certificates e2fsprogs xfsprogs blkid xfsprogs-extra e2fsprogs-extra btrfs-progs cryptsetup + +RUN apk add --no-cache \ + blkid \ + btrfs-progs \ + ca-certificates \ + cryptsetup \ + e2fsprogs \ + e2fsprogs-extra \ + xfsprogs \ + xfsprogs-extra + ENV GOTRACEBACK=all -COPY --from=builder /csi/controller.bin /bin/hcloud-csi-driver-controller -COPY --from=builder /csi/node.bin /bin/hcloud-csi-driver-node +COPY --from=builder /build/controller.bin /bin/hcloud-csi-driver-controller +COPY --from=builder /build/node.bin /bin/hcloud-csi-driver-node diff --git a/test/integration/Dockerfile b/test/integration/Dockerfile index ea868d58..4e7d7e7b 100644 --- a/test/integration/Dockerfile +++ b/test/integration/Dockerfile @@ -1,7 +1,17 @@ FROM alpine:3.13 -RUN apk add --no-cache ca-certificates e2fsprogs xfsprogs blkid xfsprogs-extra e2fsprogs-extra btrfs-progs cryptsetup -RUN apk add --no-cache coreutils +RUN apk add --no-cache \ + blkid \ + btrfs-progs \ + ca-certificates \ + cryptsetup \ + e2fsprogs \ + e2fsprogs-extra \ + xfsprogs \ + xfsprogs-extra + +RUN apk add --no-cache \ + coreutils WORKDIR /test COPY integration.tests /test/integration.tests