-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathDockerfile.alpine
31 lines (20 loc) · 1 KB
/
Dockerfile.alpine
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
FROM alpine:latest AS build
COPY . /yasdi2mqtt
RUN apk add --no-cache git gcc musl-dev make cmake openssl-dev cjson-dev paho-mqtt-c-dev
RUN ln -s termios.h /usr/include/termio.h
# Prepare DESTDIR for yasdi2mqtt
RUN mkdir -p /target/usr/local/bin
# Install YASDI
RUN git clone --depth=1 https://github.com/pkwagner/yasdi.git yasdi
RUN mkdir yasdi/projects/generic-cmake/build
RUN cd yasdi/projects/generic-cmake/build && cmake -D YASDI_DEBUG_OUTPUT=0 .. && make && make DESTDIR=/target install
# Build yasdi2mqtt
ENV LIBRARY_PATH="/target/usr/local/lib" LD_LIBRARY_PATH="/target/usr/local/lib" C_INCLUDE_PATH="/target/usr/local/include"
RUN cd yasdi2mqtt && make YASDI_PATH=../yasdi && make YASDI_PATH=../yasdi DESTDIR=/target/usr/local/bin install
FROM alpine:latest
RUN apk add --no-cache cjson paho-mqtt-c
RUN mkdir /etc/yasdi2mqtt
WORKDIR /etc/yasdi2mqtt
COPY --from=build /target/usr/local/lib/*.so* /usr/local/lib/
COPY --from=build /target/usr/local/bin/yasdi2mqtt /usr/local/bin/
ENTRYPOINT ["yasdi2mqtt"]