FROM golang:alpine AS lib_builder WORKDIR /foundry RUN apk add git make linux-headers cmake g++ RUN git clone https://github.com/jgarff/rpi_ws281x.git \ && cd rpi_ws281x \ && mkdir build \ && cd build \ && cmake -D BUILD_SHARED=OFF -D BUILD_TEST=OFF .. \ && cmake --build . \ && make install # Stage 1 : Build a go image with the rpi_ws281x C library and the go wrapper FROM golang:alpine COPY --from=lib_builder /usr/local/lib/libws2811.a /usr/local/lib/ COPY --from=lib_builder /usr/local/include/ws2811 /usr/local/include/ws2811 RUN apk add git make linux-headers cmake g++ WORKDIR /go/src/github.com/rpi-ws281x/rpi-ws281x-go COPY . . RUN GO111MODULE=off go get -d -v ./... RUN GO111MODULE=off go build -v ./... WORKDIR /go