| # stage 0: build the cos-dkms binary | |
| FROM golang:1.26.6 | |
| COPY . /work/ | |
| WORKDIR /work/src/cmd/cos_dkms | |
| ARG TARGETOS | |
| ARG TARGETARCH | |
| RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 go build -o cos-dkms main.go | |
| # stage 1: install the binary and the necessary build tools | |
| FROM marketplace.gcr.io/google/ubuntu2404:latest | |
| RUN apt-get -y update \ | |
| && apt-get install -y --no-install-recommends ca-certificates xz-utils make libelf-dev binutils kmod \ | |
| && apt-get clean | |
| COPY --from=0 /work/src/cmd/cos_dkms/cos-dkms /usr/bin/cos-dkms | |
| ENTRYPOINT ["/usr/bin/cos-dkms"] |