-
Notifications
You must be signed in to change notification settings - Fork 92
Expand file tree
/
Copy pathDockerfile
More file actions
181 lines (164 loc) · 5.08 KB
/
Dockerfile
File metadata and controls
181 lines (164 loc) · 5.08 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
ARG BUILD_FROM
####
## Builder stage for ssocr, installs to /opt/ssocr
FROM ${BUILD_FROM} AS ssocr-builder
ARG SSOCR_VERSION
ARG BUILD_FROM
WORKDIR /tmp/
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
# hadolint ignore=DL3019
RUN \
--mount=type=cache,target=/etc/apk/cache,sharing=locked,id=apk-cache-${BUILD_FROM} \
apk add \
build-base \
imlib2-dev
RUN mkdir /opt/ssocr /tmp/ssocr \
&& curl --silent --fail --location "https://github.com/auerswal/ssocr/archive/refs/tags/v${SSOCR_VERSION}.tar.gz" \
| tar zxv -C /tmp/ssocr --strip-components 1 \
&& cd /tmp/ssocr \
&& make -j"$(nproc)" \
&& make PREFIX=/opt/ssocr install \
&& rm -rf /tmp/ssocr
####
## Builder stage for libcec, installs to /opt/libcec
FROM ${BUILD_FROM} AS libcec-builder
ARG LIBCEC_VERSION
ARG BUILD_FROM
WORKDIR /tmp/
# hadolint ignore=DL3019
RUN \
--mount=type=cache,target=/etc/apk/cache,sharing=locked,id=apk-cache-${BUILD_FROM} \
apk add \
build-base \
cmake \
eudev-dev \
git \
linux-headers \
p8-platform-dev \
swig
RUN python_version=$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')") \
&& git clone --depth 1 -b "libcec-${LIBCEC_VERSION}" https://github.com/Pulse-Eight/libcec \
&& cd libcec \
&& mkdir build \
&& cd build \
&& cmake -DCMAKE_INSTALL_PREFIX:PATH=/opt/libcec \
-DPYTHON_LIBRARY="/usr/local/lib/libpython${python_version}.so" \
-DPYTHON_INCLUDE_DIR="/usr/local/include/python${python_version}" \
-DHAVE_LINUX_API=1 \
.. \
&& make -j"$(nproc)" \
&& make install
# Build stage for PicoTTS, installs to /opt/picotts
# PicoTTS - it has no specific version - commit should be taken from build.json
FROM ${BUILD_FROM} AS picotts-builder
ARG PICOTTS_HASH
ARG BUILD_FROM
WORKDIR /tmp/
# hadolint ignore=DL3019
RUN \
--mount=type=cache,target=/etc/apk/cache,sharing=locked,id=apk-cache-${BUILD_FROM} \
apk add \
autoconf \
automake \
build-base \
git \
libtool \
popt-dev
RUN git clone https://github.com/naggety/picotts.git pico \
&& cd pico/pico \
&& git reset --hard "${PICOTTS_HASH}" \
&& ./autogen.sh \
&& mkdir /opt/picotts \
# PREFIX needs to stay /usr/local with picotts, \
# see 'https://github.com/home-assistant/docker/pull/343#issuecomment-3505870990' \
&& ./configure \
--disable-static \
--prefix=/usr/local \
&& make \
&& make DESTDIR=/opt/picotts install
# Build stage for Telldus, installs to /opt/telldus
FROM ${BUILD_FROM} AS telldus-builder
ARG TELLDUS_COMMIT
ARG BUILD_FROM
WORKDIR /tmp/
COPY patches/telldus-fix-gcc-11-issues.patch /tmp/
COPY patches/telldus-fix-alpine-3-17-issues.patch /tmp/
# hadolint ignore=DL3019
RUN \
--mount=type=cache,target=/etc/apk/cache,sharing=locked,id=apk-cache-${BUILD_FROM} \
apk add \
argp-standalone \
build-base \
cmake \
confuse-dev \
doxygen \
git \
libftdi1-dev
RUN git clone https://github.com/telldus/telldus \
&& cd telldus \
&& git reset --hard "${TELLDUS_COMMIT}" \
&& git apply ../telldus-fix-gcc-11-issues.patch \
&& git apply ../telldus-fix-alpine-3-17-issues.patch \
&& cd telldus-core \
&& mkdir /opt/telldus \
&& cmake . -DBUILD_LIBTELLDUS-CORE=ON \
-DBUILD_TDADMIN=OFF -DBUILD_TDTOOL=OFF -DGENERATE_MAN=OFF \
-DFORCE_COMPILE_FROM_TRUNK=ON \
-DCMAKE_INSTALL_PREFIX:PATH=/opt/telldus \
&& make -j"$(nproc)" \
&& make install
FROM ${BUILD_FROM}
ARG BUILD_ARCH
ARG BUILD_FROM
##
# Install component packages
# hadolint ignore=DL3019
RUN \
--mount=type=cache,target=/etc/apk/cache,sharing=locked,id=apk-cache-${BUILD_FROM} \
apk add \
bluez \
bluez-deprecated \
bluez-libs \
confuse \
curl \
eudev-libs \
ffmpeg \
git \
grep \
hwdata-usb \
imlib2 \
iperf3 \
libftdi1 \
libgpiod \
libpulse \
libturbojpeg \
libzbar \
mariadb-connector-c \
net-tools \
nmap \
openssh-client \
p8-platform \
pianobar \
popt \
pulseaudio-alsa \
socat
RUN \
--mount=type=bind,src=./requirements.txt,dst=/tmp/requirements.txt \
--mount=type=cache,target=/root/.cache/pip,sharing=locked,id=pip-cache-${BUILD_FROM} \
pip3 install --only-binary=:all: \
-r /tmp/requirements.txt
WORKDIR /usr/src/
####
# Copy from ssocr builder
COPY --link --from=ssocr-builder /opt/ssocr/ /usr/local/
# Copy from libcec builder
COPY --link --from=libcec-builder /opt/libcec/ /usr/local/
RUN python_version=$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')") \
&& echo "cec" > "/usr/local/lib/python${python_version}/site-packages/cec.pth"
# Copy from picotts builder
COPY --link --from=picotts-builder /opt/picotts/usr/local/ /usr/local/
# Copy from Telldus builder
COPY --link --from=telldus-builder /opt/telldus/ /usr/local/
###
# Base S6-Overlay
COPY rootfs /