-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
41 lines (27 loc) · 892 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Stage 0 : Build the C library
FROM debian:buster-20190506 AS lib_builder
WORKDIR /foundry
RUN apt-get update -y && apt-get install -y \
build-essential \
cmake \
git
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:1.15 AS go_builder
COPY --from=lib_builder /usr/local/lib/libws2811.a /usr/local/lib/
COPY --from=lib_builder /usr/local/include/ws2811 /usr/local/include/ws2811
WORKDIR /app
COPY go.mod go.mod
COPY go.sum go.sum
RUN go mod download
COPY . .
RUN go build -o "led-lights" -v
# Stage 2 : Export compiled go binary with the light stuff
FROM scratch AS export-stage
COPY --from=go_builder /app/led-lights .