-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style: improve dockerfile readability (#627)
Improve readability, preparing for possible future changes.
- Loading branch information
Showing
4 changed files
with
70 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters