|
| 1 | +FROM golang:1.18 as common_builder |
| 2 | + |
| 3 | +WORKDIR /build |
| 4 | +COPY go.mod . |
| 5 | +COPY go.sum . |
| 6 | +RUN go mod download |
| 7 | + |
| 8 | +COPY Makefile . |
| 9 | +COPY internal/common ./internal/common |
| 10 | + |
| 11 | +FROM common_builder as device_plugin_builder |
| 12 | + |
| 13 | +COPY cmd/device-plugin ./cmd/device-plugin |
| 14 | +COPY internal/deviceplugin ./internal/deviceplugin |
| 15 | +RUN make compile |
| 16 | + |
| 17 | +FROM common_builder as status_updater_builder |
| 18 | + |
| 19 | +COPY cmd/status-updater ./cmd/status-updater |
| 20 | +COPY internal/status-updater ./internal/status-updater |
| 21 | +RUN make compile |
| 22 | + |
| 23 | +FROM common_builder as status_exporter_builder |
| 24 | + |
| 25 | +COPY cmd/status-exporter ./cmd/status-exporter |
| 26 | +COPY internal/status-exporter ./internal/status-exporter |
| 27 | +RUN make compile |
| 28 | + |
| 29 | +FROM golang:1.18 as device_plugin |
| 30 | + |
| 31 | +COPY --from=device_plugin_builder /build/bin/device-plugin /bin/ |
| 32 | +ENTRYPOINT ["/bin/device-plugin"] |
| 33 | + |
| 34 | +FROM golang:1.18 as status_updater |
| 35 | + |
| 36 | +COPY --from=status_updater_builder /build/bin/status-updater /bin/ |
| 37 | +ENTRYPOINT ["/bin/status-updater"] |
| 38 | + |
| 39 | +FROM golang:1.18 as status_exporter |
| 40 | + |
| 41 | +COPY --from=status_exporter_builder /build/bin/status-exporter /bin/ |
| 42 | +ENTRYPOINT ["/bin/status-exporter"] |
| 43 | + |
| 44 | + |
| 45 | +###### Debug images |
| 46 | +FROM golang:1.18 as debugger |
| 47 | +RUN go install github.com/go-delve/delve/cmd/dlv@latest |
| 48 | + |
| 49 | +FROM debugger as device_plugin_debug |
| 50 | + |
| 51 | +COPY --from=device_plugin_builder /build/bin/device-plugin /bin/ |
| 52 | +ENTRYPOINT ["/go/bin/dlv", "exec", "--headless", "-l", ":10000", "--api-version=2", "/bin/device-plugin", "--"] |
| 53 | + |
| 54 | +FROM debugger as status_updater_debug |
| 55 | + |
| 56 | +COPY --from=status_updater_builder /build/bin/status-updater /bin/ |
| 57 | +ENTRYPOINT ["/go/bin/dlv", "exec", "--headless", "-l", ":10000", "--api-version=2", "/bin/status-updater", "--"] |
0 commit comments