-
Notifications
You must be signed in to change notification settings - Fork 24
/
Dockerfile.arm64v8
128 lines (117 loc) · 6.68 KB
/
Dockerfile.arm64v8
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
FROM arm64v8/debian:bullseye-slim AS build
LABEL maintainer="Bastian Kleinschmidt <[email protected]>" \
org.label-schema.docker.dockerfile="/Dockerfile" \
org.label-schema.name="docker.solaranzeige"
ARG BUILD_DEPENDENCIES="build-essential make"
ARG DEPENDENCIES="autossh openssh-server usbutils hwinfo sudo gnupg2 apt-transport-https ca-certificates cron software-properties-common mcedit nano apache2 sed iproute2 curl wget git net-tools inetutils-ping sqlite3 php-common php-pear php-ssh2 php-xml php7.4 php7.4-cgi php7.4-cli php7.4-common php7.4-curl php7.4-dev php7.4-gd php7.4-json php7.4-opcache php7.4-readline php7.4-sqlite3 php7.4-xml libapache2-mod-php"
ENV USER_ID="99" \
GROUP_ID="100" \
TIMEZONE="Europe/Berlin" \
UPDATE="yes" \
MOSQUITTO="yes" \
INFLUXDB="yes" \
DEBIAN_FRONTEND="noninteractive" \
TERM=xterm \
LANGUAGE="en_US.UTF-8" \
LANG="en_US.UTF-8" \
LC_ALL="en_US.UTF-8" \
CLEANUP="/tmp/* /var/tmp/* /var/log/* /var/lib/apt/lists/* /var/lib/{apt,dpkg,cache,log}/ /var/cache/apt/archives /usr/share/doc/ /usr/share/man/ /usr/share/locale/ "
COPY root/entrypoint /usr/local/sbin/entrypoint
COPY root/solaranzeige.process /usr/local/sbin/solaranzeige.process
COPY root/solaranzeige.update /usr/local/sbin/solaranzeige.update
COPY root/solaranzeige.setup /usr/local/sbin/solaranzeige.setup
COPY root/pvforecast.update /usr/local/sbin/pvforecast.update
COPY root/steuerung.setup /usr/local/sbin/steuerung.setup
COPY root/qemu-aarch64-static /usr/bin/
RUN apt-get -qy update \
### tweak some apt & dpkg settngs
&& echo "APT::Install-Recommends "0";" >> /etc/apt/apt.conf.d/docker-noinstall-recommends \
&& echo "APT::Install-Suggests "0";" >> /etc/apt/apt.conf.d/docker-noinstall-suggests \
&& echo "Dir::Cache "";" >> /etc/apt/apt.conf.d/docker-nocache \
&& echo "Dir::Cache::archives "";" >> /etc/apt/apt.conf.d/docker-nocache \
&& echo "path-exclude=/usr/share/locale/*" >> /etc/dpkg/dpkg.cfg.d/docker-nolocales \
&& echo "path-exclude=/usr/share/man/*" >> /etc/dpkg/dpkg.cfg.d/docker-noman \
&& echo "path-exclude=/usr/share/doc/*" >> /etc/dpkg/dpkg.cfg.d/docker-nodoc \
&& echo "path-include=/usr/share/doc/*/copyright" >> /etc/dpkg/dpkg.cfg.d/docker-nodoc \
### install basic packages
&& apt-get install -qy apt-utils locales tzdata \
### limit locale to en_US.UTF-8
&& sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
&& locale-gen en_US.UTF-8 \
&& update-locale LANG=en_US.UTF-8 \
&& locale-gen --purge en_US.UTF-8 \
### run dist-upgrade
&& apt-get dist-upgrade -qy \
### install solaranzeige dependencies
&& apt-get install -qy ${BUILD_DEPENDENCIES} ${DEPENDENCIES} \
&& curl -fsSL https://packages.grafana.com/gpg.key | apt-key add - \
&& echo "deb https://packages.grafana.com/oss/deb stable main" | tee -a /etc/apt/sources.list.d/grafana.list \
&& curl -fsSL https://repos.influxdata.com/influxdata-archive_compat.key | apt-key add - \
&& echo "deb https://repos.influxdata.com/debian bullseye stable" | tee -a /etc/apt/sources.list.d/influxdb.list \
&& curl -fsSL http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key | apt-key add - \
&& echo "deb https://repo.mosquitto.org/debian bullseye main" | tee -a /etc/apt/sources.list.d/mosquitto.list \
&& apt-get update \
### install solaranzeige dependencies
&& apt-get install -qy ${BUILD_DEPENDENCIES} ${DEPENDENCIES} \
&& curl -fsSL https://packages.grafana.com/gpg.key | apt-key add - \
&& echo "deb https://packages.grafana.com/oss/deb stable main" | tee -a /etc/apt/sources.list.d/grafana.list \
&& curl -fsSL https://repos.influxdata.com/influxdata-archive_compat.key | apt-key add - \
&& echo "deb https://repos.influxdata.com/debian bullseye stable" | tee -a /etc/apt/sources.list.d/influxdb.list \
&& curl -fsSL http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key | apt-key add - \
&& echo "deb https://repo.mosquitto.org/debian bullseye main" | tee -a /etc/apt/sources.list.d/mosquitto.list \
&& apt-get update \
### install solaranzeige dependencies
&& apt install -qy influxdb grafana mosquitto mosquitto-clients libmosquitto-dev \
&& pecl install Mosquitto-alpha \
&& echo "extension=mosquitto.so" | tee -a /etc/php/7.4/mods-available/mosquitto.ini \
### install PVForecast depedencies
&& apt-get install -qy python3-pip python3-elementpath python3-protobuf netcdf-bin python3-bs4 python3-requests python3-numpy python3-pandas python3-h5py python3-tables python3-netcdf4 python3-scipy python3-influxdb python3-setuptools python3-astral python3-wheel python3-wrapt python3-yaml python3-isodate \
&& python3 -m pip install pip --upgrade \
&& python3 -m pip install pysolcast \
&& python3 -m pip install astral --upgrade \
&& python3 -m pip install siphon --upgrade \
&& python3 -m pip install pvlib \
&& python3 -m pip install packaging \
&& python3 -m pip install influxdb --upgrade \
### configure system
&& update-ca-certificates --fresh \
&& phpenmod mosquitto \
&& a2enmod php7.4 \
&& sed -i 's/\/var\/log/\/var\/www\/log/g' /etc/apache2/envvars \
&& sed -i 's/\/var\/log/\/var\/www\/log/g' /etc/default/grafana-server \
&& sed -i 's/ulimit/#ulimit/g' /etc/init.d/influxdb \
&& echo "STDERR=/var/www/log/influxdb.log" > /etc/default/influxdb \
&& sed -i 's/;error_log = syslog/error_log = \/var\/www\/log\/php.log/g' /etc/php/7.4/cli/php.ini \
### install grafana plugins
&& grafana-cli plugins install fetzerch-sunandmoon-datasource \
&& grafana-cli plugins install briangann-gauge-panel \
&& grafana-cli plugins install agenty-flowcharting-panel \
### alter permissions
&& chmod +x /usr/local/sbin/entrypoint \
&& chmod +x /usr/local/sbin/solaranzeige.process \
&& chmod +x /usr/local/sbin/solaranzeige.update \
&& chmod +x /usr/local/sbin/solaranzeige.setup \
&& chmod +x /usr/local/sbin/steuerung.setup \
&& chmod +x /usr/local/sbin/pvforecast.update \
### cleanup
&& apt-get remove --purge -qy ${BUILD_DEPENDENCIES} \
&& apt-get -qy autoclean \
&& apt-get -qy clean \
&& apt-get -qy autoremove --purge \
&& rm -rf ${CLEANUP}
COPY root/update /usr/local/sbin/update
COPY root/truncate_log /usr/local/sbin/truncate_log
COPY root/solaranzeige_cron /etc/cron.d/solaranzeige_cron
RUN chmod +x /usr/local/sbin/update \
&& chmod +x /usr/local/sbin/truncate_log \
&& chmod 0644 /etc/cron.d/solaranzeige_cron \
&& crontab /etc/cron.d/solaranzeige_cron
ENTRYPOINT [ "/usr/local/sbin/entrypoint" ]
VOLUME /solaranzeige
VOLUME /pvforecast
VOLUME /var/www
VOLUME /var/lib/influxdb
VOLUME /var/lib/grafana
EXPOSE 3000
EXPOSE 80
EXPOSE 1883