-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
82 lines (63 loc) · 3.78 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
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
FROM python:3.10-buster
LABEL org.opencontainers.image.authors="David Baetge <david.baetge@gmail.com>"
ARG WEEWX_VERSION="5.0.2"
ARG WDC_VERSION="v3.5.0"
ARG WEEWX_UID=2749
ENV WEEWX_HOME="/home/weewx-data"
EXPOSE 9877
COPY src/start.sh /start.sh
COPY src/extensions.py /tmp
RUN chmod +x /start.sh
# @see https://blog.nuvotex.de/running-syslog-in-a-container/
# @todo https://www.weewx.com/docs/5.0/usersguide/monitoring/#logging-on-macos
RUN apt-get update &&\
apt-get install -q -y --no-install-recommends rsyslog=8.1901.0-1+deb10u2 python3-pip=18.1-5 python3-venv=3.7.3-1 &&\
apt-get clean &&\
rm -rf /var/lib/apt/lists/*
RUN addgroup --system --gid ${WEEWX_UID} weewx &&\
adduser --system --uid ${WEEWX_UID} --ingroup weewx weewx
# Configure timezone.
RUN ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
WORKDIR /tmp
RUN wget -nv -O "weewx-interceptor.zip" "https://github.com/matthewwall/weewx-interceptor/archive/master.zip" &&\
wget -nv -O "weewx-wdc-${WDC_VERSION}.zip" "https://github.com/Daveiano/weewx-wdc/releases/download/${WDC_VERSION}/weewx-wdc-${WDC_VERSION}.zip" &&\
wget -nv -O "weewx-forecast.zip" "https://github.com/chaunceygardiner/weewx-forecast/archive/refs/heads/master.zip" &&\
wget -nv -O "weewx-cmon.zip" "https://github.com/bellrichm/weewx-cmon/archive/refs/heads/master.zip" &&\
wget -nv -O "weewx-xaggs.zip" "https://github.com/tkeffer/weewx-xaggs/archive/master.zip" &&\
wget -nv -O "weewx-xcumulative.tar.gz" "https://github.com/gjr80/weewx-xcumulative/releases/download/v0.1.0/xcum-0.1.0.tar.gz" &&\
wget -nv -O "weewx-GTS.zip" "https://github.com/roe-dl/weewx-GTS/archive/master.zip"
RUN mkdir /tmp/weewx-wdc/ &&\
unzip /tmp/weewx-wdc-${WDC_VERSION}.zip -d /tmp/weewx-wdc/
WORKDIR ${WEEWX_HOME}
RUN python3 -m venv ${WEEWX_HOME}/weewx-venv &&\
. ${WEEWX_HOME}/weewx-venv/bin/activate &&\
python3 -m pip install --no-cache-dir weewx==${WEEWX_VERSION} six==1.16.0
RUN . ${WEEWX_HOME}/weewx-venv/bin/activate &&\
weectl station create "${WEEWX_HOME}" --no-prompt \
--driver=weewx.drivers.simulator \
--altitude="250,meter" \
--latitude=51.209 \
--longitude=14.085 \
--location="Haselbachtal, Saxony, Germany" \
--register="y" \
--station-url="https://www.weewx-hbt.de/" \
--units="metric"
RUN . ${WEEWX_HOME}/weewx-venv/bin/activate &&\
weectl extension install -y --config "${WEEWX_HOME}/weewx.conf" /tmp/weewx-interceptor.zip &&\
weectl extension install -y --config "${WEEWX_HOME}/weewx.conf" /tmp/weewx-forecast.zip &&\
weectl extension install -y --config "${WEEWX_HOME}/weewx.conf" /tmp/weewx-cmon.zip &&\
weectl extension install -y --config "${WEEWX_HOME}/weewx.conf" /tmp/weewx-xaggs.zip &&\
weectl extension install -y --config "${WEEWX_HOME}/weewx.conf" /tmp/weewx-xcumulative.tar.gz &&\
weectl extension install -y --config "${WEEWX_HOME}/weewx.conf" /tmp/weewx-GTS.zip &&\
weectl extension install -y --config "${WEEWX_HOME}/weewx.conf" /tmp/weewx-wdc/
RUN . ${WEEWX_HOME}/weewx-venv/bin/activate &&\
weectl extension list --config "${WEEWX_HOME}/weewx.conf" &&\
weectl station reconfigure --weewx-root "${WEEWX_HOME}" --config "${WEEWX_HOME}/weewx.conf" --driver=user.interceptor --no-prompt
COPY src/skin.conf ./skins/weewx-wdc/
RUN sed -i -e 's/device_type = acurite-bridge/device_type = ecowitt-client\n port = 9877\n address = 0.0.0.0/g' weewx.conf &&\
sed -i -z -e 's/skin = Seasons\n enable = true/skin = Seasons\n enable = false/g' weewx.conf &&\
sed -i -z -e 's/skin = forecast/skin = forecast\n enable = false/g' weewx.conf &&\
cat /tmp/extensions.py >> "${WEEWX_HOME}"/bin/user/extensions.py
VOLUME [ "${WEEWX_HOME}/public_html" ]
VOLUME [ "${WEEWX_HOME}/archive" ]
ENTRYPOINT [ "/start.sh" ]