diff --git a/Dockerfile b/Dockerfile index 94f181a..1bf10a9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,24 @@ -FROM golang:1.19-alpine as gobuild +#FROM golang:1.19-alpine as gobuild +FROM registry.cn-hangzhou.aliyuncs.com/eryajf/golang:1.20.14-alpine3.19 as gobuild WORKDIR /build +ENV GOPROXY=https://goproxy.cn ADD go.mod go.sum /build/ RUN go mod download -x ADD cmd /build/cmd ADD pkg /build/pkg RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o ./s3driver ./cmd/s3driver -FROM alpine:3.17 +#FROM alpine:3.17 +FROM registry.cn-hangzhou.aliyuncs.com/eryajf/alpine:3.19 LABEL maintainers="Vitaliy Filippov " LABEL description="csi-s3 slim image" RUN apk add --no-cache fuse mailcap rclone RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/community s3fs-fuse -ADD https://github.com/yandex-cloud/geesefs/releases/latest/download/geesefs-linux-amd64 /usr/bin/geesefs +#ADD https://github.com/yandex-cloud/geesefs/releases/latest/download/geesefs-linux-amd64 /usr/bin/geesefs +ADD geesefs /usr/bin/geesefs RUN chmod 755 /usr/bin/geesefs COPY --from=gobuild /build/s3driver /s3driver diff --git a/geesefs b/geesefs new file mode 100644 index 0000000..2b6ae03 Binary files /dev/null and b/geesefs differ diff --git a/pkg/mounter/mounter.go b/pkg/mounter/mounter.go index d190f20..4d67ee1 100644 --- a/pkg/mounter/mounter.go +++ b/pkg/mounter/mounter.go @@ -31,7 +31,7 @@ const ( rcloneMounterType = "rclone" TypeKey = "mounter" BucketKey = "bucket" - OptionsKey = "options" + OptionsKey = "options" ) // New returns a new mounter depending on the mounterType parameter @@ -73,7 +73,15 @@ func fuseMount(path string, command string, args []string, envs []string) error } func Unmount(path string) error { - if err := mount.New("").Unmount(path); err != nil { + mounter := mount.New("") + isNotMountPoint, err := mounter.IsNotMountPoint(path) + + if isNotMountPoint || err != nil { + glog.Warningf("Skip Unmount since path (%s) may not a valid mount point: %v", path, err) + return nil + } + + if err := mounter.Unmount(path); err != nil { return err } return nil