-
Notifications
You must be signed in to change notification settings - Fork 289
/
Dockerfile
53 lines (42 loc) · 1.55 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
FROM debian:bookworm-slim AS base
ARG BUILD_VERSION="OSPI"
########################################
## 1st stage compiles OpenSprinkler runtime dependency raspi-gpio
FROM base AS raspi-gpio-build
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y git gcc make automake
RUN rm -rf /var/lib/apt/lists/*
RUN mkdir /raspi-gpio
WORKDIR /raspi-gpio
RUN git clone --depth 1 https://github.com/RPi-Distro/raspi-gpio.git .
RUN autoreconf -f -i
RUN (./configure || cat config.log)
RUN make
########################################
## 2nd stage compiles OpenSprinkler code
FROM base AS os-build
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y bash g++ make libmosquittopp-dev libssl-dev
RUN rm -rf /var/lib/apt/lists/*
COPY . /OpenSprinkler
WORKDIR /OpenSprinkler
RUN make clean
RUN make VERSION=${BUILD_VERSION}
########################################
## 3rd stage is minimal runtime + executable
FROM base
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y libstdc++6 libmosquittopp1
RUN rm -rf /var/lib/apt/lists/*
RUN mkdir /OpenSprinkler
RUN mkdir -p /data/logs
COPY --from=os-build /OpenSprinkler/OpenSprinkler /OpenSprinkler/OpenSprinkler
COPY --from=raspi-gpio-build /raspi-gpio/raspi-gpio /usr/bin/raspi-gpio
WORKDIR /OpenSprinkler
#-- Logs and config information go into the volume on /data
VOLUME /data
#-- OpenSprinkler interface is available on 8080
EXPOSE 8080
#-- By default, start OS using /data for saving data/NVM/log files
CMD [ "/OpenSprinkler/OpenSprinkler", "-d", "/data" ]