FROM golang:1.10 as builder
COPY . /go/src/docker-volume-iscsi
WORKDIR /go/src/docker-volume-iscsi
RUN set -ex \
    && apt-get install gcc libc-dev \
    && go install --ldflags '-extldflags "-static"'
CMD ["/go/bin/docker-volume-iscsi"]

FROM ubuntu:focal

ADD iscsiadm /usr/local/sbin
RUN chmod 777 /usr/local/sbin/iscsiadm

COPY --from=builder /go/bin/docker-volume-iscsi .
CMD ["/docker-volume-iscsi"]

