You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
910 B
Docker

FROM golang:alpine AS lib_builder
WORKDIR /foundry
# install build deps (use build-base to get gcc/g++)
RUN apk add --no-cache git build-base linux-headers cmake
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 . --target 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
# enable cgo and install build deps for the Go build
ENV CGO_ENABLED=1
RUN apk add --no-cache git build-base linux-headers cmake
WORKDIR /go/src/github.com/rpi-ws281x/rpi-ws281x-go
COPY . .
# Build in GOPATH mode (this repo has no go.mod).
ENV GO111MODULE=off
RUN go build -v ./...
WORKDIR /go