FROM alpine
ARG PREFIX=/opt/spm/fswrap-master
RUN apk update && apk add \
	git \
	cmake \
	make \
	gcc \
	musl-dev
RUN git clone --depth 1 https://gitea.privatedns.org/xavi/fswrap
WORKDIR /fswrap
RUN LDFLAGS="-static -Wl,--gc-sections" \
    CFLAGS="-ffunction-sections -fdata-sections" \
    cmake -B build \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=$PREFIX
RUN cmake --build build/ --parallel $(nproc --all) -v
RUN cmake --install build/
WORKDIR $PREFIX/bin
RUN strip fswrap
