-
Notifications
You must be signed in to change notification settings - Fork 28
/
Dockerfile
103 lines (72 loc) · 2.85 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# syntax = docker/dockerfile:1.10
########################################
FROM golang:1.23-bookworm AS develop
WORKDIR /src
COPY ["go.mod", "go.sum", "/src"]
RUN go mod download
########################################
FROM --platform=${BUILDPLATFORM} golang:1.23.3-alpine3.20 AS builder
RUN apk update && apk add --no-cache make
ENV GO111MODULE=on
WORKDIR /src
COPY ["go.mod", "go.sum", "/src"]
RUN go mod download && go mod verify
COPY . .
ARG TAG
ARG SHA
RUN make build-all-archs
########################################
FROM --platform=${TARGETARCH} scratch AS proxmox-csi-controller
LABEL org.opencontainers.image.source="https://github.com/sergelogvinov/proxmox-csi-plugin" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.description="Proxmox VE CSI plugin"
COPY --from=gcr.io/distroless/static-debian12:nonroot . .
ARG TARGETARCH
COPY --from=builder /src/bin/proxmox-csi-controller-${TARGETARCH} /bin/proxmox-csi-controller
ENTRYPOINT ["/bin/proxmox-csi-controller"]
########################################
FROM --platform=${TARGETARCH} debian:12.7 AS tools
RUN apt-get update && apt-get install -y --no-install-recommends \
bash \
mount \
udev \
e2fsprogs \
xfsprogs \
util-linux \
cryptsetup \
rsync
COPY tools /tools
RUN /tools/deps.sh
########################################
FROM --platform=${TARGETARCH} gcr.io/distroless/base-debian12 AS tools-check
COPY --from=tools /bin/sh /bin/sh
COPY --from=tools /tools /tools
COPY --from=tools /dest /
SHELL ["/bin/sh"]
RUN /tools/deps-check.sh
########################################
FROM --platform=${TARGETARCH} scratch AS proxmox-csi-node
LABEL org.opencontainers.image.source="https://github.com/sergelogvinov/proxmox-csi-plugin" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.description="Proxmox VE CSI plugin"
COPY --from=gcr.io/distroless/base-debian12 . .
COPY --from=tools /dest /
ARG TARGETARCH
COPY --from=builder /src/bin/proxmox-csi-node-${TARGETARCH} /bin/proxmox-csi-node
ENTRYPOINT ["/bin/proxmox-csi-node"]
########################################
FROM alpine:3.20 AS pvecsictl
LABEL org.opencontainers.image.source="https://github.com/sergelogvinov/proxmox-csi-plugin" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.description="Proxmox VE CSI tools"
ARG TARGETARCH
COPY --from=builder /src/bin/pvecsictl-${TARGETARCH} /bin/pvecsictl
ENTRYPOINT ["/bin/pvecsictl"]
########################################
FROM alpine:3.20 AS pvecsictl-goreleaser
LABEL org.opencontainers.image.source="https://github.com/sergelogvinov/proxmox-csi-plugin" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.description="Proxmox VE CSI tools"
ARG TARGETARCH
COPY pvecsictl-linux-${TARGETARCH} /bin/pvecsictl
ENTRYPOINT ["/bin/pvecsictl"]