Skip to content
This repository was archived by the owner on Jan 1, 2024. It is now read-only.

Commit 382f4a5

Browse files
authored
Merge pull request #3 from linuxserver/sslcert_path
ssl keygen
2 parents 5ef11a6 + 39e365b commit 382f4a5

File tree

7 files changed

+61
-23
lines changed

7 files changed

+61
-23
lines changed

Dockerfile

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DA
99
# Environment settings
1010
ENV HOME="/config"
1111

12-
# copy local files
13-
COPY root/ /
12+
# copy prebuilds
13+
COPY prebuilds/ /usr/
1414

1515
# install build dependencies
1616
RUN \
@@ -19,7 +19,6 @@ RUN \
1919
automake \
2020
boost-dev \
2121
cmake \
22-
coreutils \
2322
curl-dev \
2423
eudev-dev \
2524
g++ \
@@ -28,49 +27,78 @@ RUN \
2827
libcurl \
2928
libusb-compat-dev \
3029
libusb-dev \
30+
linux-headers \
31+
lua5.2-dev \
3132
make \
33+
mosquitto-dev \
3234
openssl-dev \
3335
pkgconf \
3436
sqlite-dev \
3537
tar \
3638
zlib-dev && \
3739

40+
# add runtime packages required in build stage
41+
apk add --no-cache \
42+
python3-dev && \
43+
3844
# build OpenZWave
3945
git clone https://github.com/OpenZWave/open-zwave.git /tmp/open-zwave && \
4046
ln -s /tmp/open-zwave /tmp/open-zwave-read-only && \
4147
cd /tmp/open-zwave && \
4248
make && \
49+
make \
50+
instlibdir=usr/lib \
51+
pkgconfigdir="usr/lib/pkgconfig/" \
52+
PREFIX=/usr \
53+
sysconfdir=etc/openzwave \
54+
install && \
4355

4456
# build domoticz
4557
git clone https://github.com/domoticz/domoticz.git /tmp/domoticz && \
4658
cd /tmp/domoticz && \
47-
cmake -USE_STATIC_OPENZWAVE -DCMAKE_BUILD_TYPE=Release . && \
59+
cmake \
60+
-DBUILD_SHARED_LIBS=True \
61+
-DCMAKE_BUILD_TYPE=Release \
62+
-DCMAKE_INSTALL_PREFIX=/var/lib/domoticz \
63+
-DOpenZWave=/usr/lib/libopenzwave.so \
64+
-DUSE_BUILTIN_LUA=OFF \
65+
-DUSE_BUILTIN_MQTT=OFF \
66+
-DUSE_BUILTIN_SQLITE=OFF \
67+
-DUSE_STATIC_LIBSTDCXX=OFF \
68+
-DUSE_STATIC_OPENZWAVE=OFF && \
4869
make && \
4970
make install && \
5071

72+
# determine runtime packages
73+
RUNTIME_PACKAGES="$( \
74+
scanelf --needed --nobanner /var/lib/domoticz/domoticz \
75+
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
76+
| sort -u \
77+
| xargs -r apk info --installed \
78+
| sort -u \
79+
)" && \
80+
81+
# install runtime dependencies
82+
apk add --no-cache \
83+
eudev-libs \
84+
openssl \
85+
$RUNTIME_PACKAGES && \
86+
5187
# cleanup build dependencies
5288
apk del --purge \
5389
build-dependencies && \
5490

55-
# install runtime dependencies
56-
apk add --no-cache \
57-
libcrypto1.0 \
58-
libcurl \
59-
libssl1.0 \
60-
libstdc++ \
61-
libusb \
62-
libusb-compat \
63-
zlib && \
6491

6592
# add abc to dialout and cron group trying to fix different GID for dialout group
66-
usermod -a -G 16 abc && \
67-
usermod -a -G 20 abc && \
93+
usermod -a -G 16,20 abc && \
6894

6995
# cleanup /tmp
7096
rm -rf \
7197
/tmp/*
7298

99+
# copy local files
100+
COPY root/ /
101+
73102
# ports and volumes
74103
EXPOSE 8080 6144 1443
75-
76-
VOLUME /config
104+
VOLUME /config
File renamed without changes.
File renamed without changes.

root/etc/cont-init.d/30-config

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
#!/usr/bin/with-contenv bash
22

3+
# make our folders
4+
mkdir -p \
5+
/config/keys
6+
37
# copy default scripts from install
48
[[ ! -e /config/scripts ]] && \
5-
cp -R /opt/domoticz/scripts /config/
9+
cp -R /var/lib/domoticz/scripts /config/
610

7-
# copy default ssl certificate
8-
[[ ! -e /config/server_cert.pem ]] && \
9-
cp /opt/domoticz/server_cert.pem /config/server_cert.pem
11+
# generate ssl certificate
12+
if [ ! -e /config/keys/server_cert.pem ]; then
13+
[[ -e /config/keys/RSA2048.pem ]] && rm /config/keys/RSA2048.pem
14+
openssl dhparam -out /config/keys/RSA2048.pem -5 2048
15+
openssl req -x509 -nodes -days 365 \
16+
-newkey rsa:2048 -keyout /config/keys/server_cert.pem -out /config/keys/server_cert.pem \
17+
-subj "/CN=domoticz"
18+
cat /config/keys/RSA2048.pem >> /config/keys/server_cert.pem
19+
fi
1020

1121
# set permissions for /config
1222
chown -R abc:abc \

root/etc/services.d/domoticz/run

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/with-contenv bash
22
exec \
3-
s6-setuidgid abc /opt/domoticz/domoticz \
3+
s6-setuidgid abc /var/lib/domoticz/domoticz \
44
-sslwww 1443 \
5-
-sslcert /config/server_cert.pem \
5+
-sslcert /config/keys/server_cert.pem \
66
-userdata /config/ \
77
-dbase /config/domoticz.db \
88
-syslog

0 commit comments

Comments
 (0)