Skip to content

example compiling inside docker as well #34

@glimchb

Description

@glimchb

just an example for people don't want to install specific go version on the local machine...

diff --git a/deploy/image/Dockerfile b/deploy/image/Dockerfile
index 9773a1e..f44d4a5 100644
--- a/deploy/image/Dockerfile
+++ b/deploy/image/Dockerfile
@@ -4,11 +4,15 @@
 #
 # XXX: pin alpine to 3.8 with e2fsprogs-1.44
 # e2fsprogs-1.45+ crashes my test vm when running mkfs.ext4
+FROM docker.io/library/golang:1.22.0-alpine3.19 as builder
+COPY . .
+RUN CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -o /tmp/spdkcsi ./cmd/
+
 FROM alpine:3.8
 LABEL maintainers="SPDK-CSI Authors"
 LABEL description="SPDK-CSI Plugin"

-COPY spdkcsi /usr/local/bin/spdkcsi
+COPY --from=builder /tmp/spdkcsi /usr/local/bin/spdkcsi

 RUN apk add nvme-cli open-iscsi e2fsprogs xfsprogs blkid

(END)

and then

docker build -t spdkcsi/spdkcsi:canary -f deploy/image/Dockerfile .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions