Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example compiling inside docker as well #34

Open
glimchb opened this issue Feb 14, 2024 · 0 comments
Open

example compiling inside docker as well #34

glimchb opened this issue Feb 14, 2024 · 0 comments

Comments

@glimchb
Copy link

glimchb commented Feb 14, 2024

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 .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant