forked from SynologyOpenSource/synology-csi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
43 lines (32 loc) · 1.23 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Copyright 2021 Synology Inc.
############## Build stage ##############
FROM golang:1.20.5-alpine as builder
LABEL stage=synobuilder
RUN apk add --no-cache alpine-sdk
WORKDIR /go/src/synok8scsiplugin
COPY go.mod go.sum ./
RUN go mod download
COPY Makefile .
ARG TARGETPLATFORM
COPY main.go .
COPY pkg ./pkg
RUN env GOARCH=$(echo "$TARGETPLATFORM" | cut -f2 -d/) \
GOARM=$(echo "$TARGETPLATFORM" | cut -f3 -d/ | cut -c2-) \
make
############## Final stage ##############
FROM alpine:latest
LABEL maintainers="Synology Authors" \
description="Synology CSI Plugin"
RUN apk add --no-cache e2fsprogs e2fsprogs-extra xfsprogs xfsprogs-extra blkid util-linux iproute2 bash btrfs-progs ca-certificates cifs-utils
# Create symbolic link for chroot.sh
WORKDIR /
RUN mkdir /csibin
COPY chroot/chroot.sh /csibin
RUN chmod 777 /csibin/chroot.sh \
&& ln -s /csibin/chroot.sh /csibin/iscsiadm \
&& ln -s /csibin/chroot.sh /csibin/multipath \
&& ln -s /csibin/chroot.sh /csibin/multipathd
ENV PATH="/csibin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Copy and run CSI driver
COPY --from=builder /go/src/synok8scsiplugin/bin/synology-csi-driver synology-csi-driver
ENTRYPOINT ["/synology-csi-driver"]