forked from felddy/weewx-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
68 lines (49 loc) · 2.03 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
FROM python:3-alpine as stage-1
ARG WEEWX_UID=421
ENV WEEWX_HOME="/home/weewx"
ENV WEEWX_VERSION="4.4.0"
ENV ARCHIVE="weewx-${WEEWX_VERSION}.tar.gz"
RUN addgroup --system --gid ${WEEWX_UID} weewx \
&& adduser --system --uid ${WEEWX_UID} --ingroup weewx weewx
RUN apk --no-cache add tar
WORKDIR /tmp
COPY src/hashes requirements.txt ./
# Download sources and verify hashes
RUN wget -O "${ARCHIVE}" "http://www.weewx.com/downloads/released_versions/${ARCHIVE}"
RUN wget -O weewx-mqtt.zip https://github.com/matthewwall/weewx-mqtt/archive/master.zip
RUN wget -O weewx-interceptor.zip https://github.com/matthewwall/weewx-interceptor/archive/master.zip
RUN sha256sum -c < hashes
# WeeWX setup
RUN tar --extract --gunzip --directory ${WEEWX_HOME} --strip-components=1 --file "${ARCHIVE}"
RUN chown -R weewx:weewx ${WEEWX_HOME}
# Python setup
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install --no-cache --requirement requirements.txt
WORKDIR ${WEEWX_HOME}
RUN bin/wee_extension --install /tmp/weewx-mqtt.zip
RUN bin/wee_extension --install /tmp/weewx-interceptor.zip
COPY src/entrypoint.sh src/version.txt ./
FROM python:3-slim as stage-2
ARG TARGETPLATFORM
ARG WEEWX_UID=421
ENV WEEWX_HOME="/home/weewx"
ENV WEEWX_VERSION="4.4.0"
# For a list of pre-defined annotation keys and value types see:
# https://github.com/opencontainers/image-spec/blob/master/annotations.md
# Note: Additional labels are added by the build workflow.
LABEL org.opencontainers.image.authors="markf+github@geekpad.com"
LABEL org.opencontainers.image.vendor="Geekpad"
LABEL com.weewx.version=${WEEWX_VERSION}
RUN addgroup --system --gid ${WEEWX_UID} weewx \
&& adduser --system --uid ${WEEWX_UID} --ingroup weewx weewx
RUN apt-get update && apt-get install -y libusb-1.0-0 gosu busybox-syslogd tzdata
WORKDIR ${WEEWX_HOME}
COPY --from=stage-1 /opt/venv /opt/venv
COPY --from=stage-1 ${WEEWX_HOME} ${WEEWX_HOME}
RUN mkdir /data && \
cp weewx.conf /data
VOLUME ["/data"]
ENV PATH="/opt/venv/bin:$PATH"
ENTRYPOINT ["./entrypoint.sh"]
CMD ["/data/weewx.conf"]