|
| 1 | +# Copyright (c) 2025 Saglabs SA. All Rights Reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +ARG CSI_TAG="v0.9.8" |
| 16 | +ARG MFS_TAG="v4.58.1" |
| 17 | + |
| 18 | +#Build MooseFS CSI driver from source |
| 19 | +FROM golang:1.25-alpine3.22 AS csibuilder |
| 20 | +WORKDIR /build |
| 21 | +ARG CSI_TAG |
| 22 | +RUN apk add --update git |
| 23 | +COPY ./ /build |
| 24 | +RUN CGO_ENABLED=0 GOCACHE=/tmp/go-cache GOOS=linux go build -a -o /build/moosefs-csi-plugin cmd/moosefs-csi-plugin/main.go |
| 25 | + |
| 26 | +# MooseFS client is required for the CSI driver to mount volumes |
| 27 | +FROM moosefs/mfsbuilder:alpine3.22 AS mfsbuilder |
| 28 | +WORKDIR /moosefs |
| 29 | +ARG MFS_TAG |
| 30 | +RUN git clone --depth 1 --branch ${MFS_TAG} https://github.com/moosefs/moosefs.git /moosefs |
| 31 | +RUN autoreconf -f -i |
| 32 | +RUN ./configure --prefix=/usr --mandir=/share/man --sysconfdir=/etc --localstatedir=/var/lib --with-default-user=mfs --with-default-group=mfs --disable-mfsbdev --disable-mfsmaster --disable-mfschunkserver --disable-mfsmetalogger --disable-mfsnetdump --disable-mfscgi --disable-mfscgiserv --disable-mfscli |
| 33 | +RUN cd /moosefs/mfsclient && make DESTDIR=/tmp/ install |
| 34 | + |
| 35 | +#Build CSI plugin container |
| 36 | +FROM alpine:3.22 |
| 37 | +RUN apk add --update fuse3-libs findmnt |
| 38 | +COPY --from=csibuilder /build/moosefs-csi-plugin /bin/moosefs-csi-plugin |
| 39 | +COPY --from=mfsbuilder /tmp/usr/bin /usr/bin |
| 40 | +RUN ["ln", "-s", "/usr/bin/mfsmount", "/usr/sbin/mount.moosefs"] |
| 41 | +ENTRYPOINT ["/bin/moosefs-csi-plugin"] |
0 commit comments