FROM alpine AS mirror

RUN mkdir -p /out/etc/apk/ && \
    cp /etc/apk/repositories /out/etc/apk/ && \
    cp -r /etc/apk/keys /out/etc/apk/keys

RUN mkdir /out/dev && mknod -m 666 /out/dev/urandom c 1 9

RUN apk add --no-cache --initdb -p /out \
    open-iscsi \
    targetcli

RUN rm -rf /out/dev


FROM scratch
MAINTAINER Pierre-Olivier Mercier <nemunaire@nemunai.re>

COPY --from=mirror /out/ /
