mirror of
https://github.com/SynologyOpenSource/synology-csi.git
synced 2026-02-13 21:00:03 +00:00
The tool executor is capable of running given tools in chroot either by automatically locating the tools in path using the `env` command or directly if the path is known. This removes the need for the shell script to wrap commands and reduces number of needed external binaries on the node.
36 lines
946 B
Docker
36 lines
946 B
Docker
# Copyright 2021 Synology Inc.
|
|
|
|
############## Build stage ##############
|
|
FROM golang:1.21.4-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 nfs-utils
|
|
|
|
# Create symbolic link for chroot.sh
|
|
WORKDIR /
|
|
|
|
# Copy and run CSI driver
|
|
COPY --from=builder /go/src/synok8scsiplugin/bin/synology-csi-driver synology-csi-driver
|
|
|
|
ENTRYPOINT ["/synology-csi-driver"]
|