2022-07-15 18:29:23 +00:00
|
|
|
FROM python:3.10.5-slim-bullseye as install
|
2022-01-30 22:11:34 +00:00
|
|
|
|
2022-07-15 18:29:23 +00:00
|
|
|
ARG WEEWX_UID=421
|
2022-01-30 22:11:34 +00:00
|
|
|
ENV WEEWX_HOME="/home/weewx"
|
2022-07-15 18:29:23 +00:00
|
|
|
ENV WEEWX_VERSION="4.8.0"
|
|
|
|
ENV ARCHIVE="weewx-${WEEWX_VERSION}.tar.gz"
|
|
|
|
ENV WEEWX_WDC_VERSION="v1.3.1"
|
2022-01-30 22:11:34 +00:00
|
|
|
|
2022-07-15 18:29:23 +00:00
|
|
|
RUN addgroup --system --gid ${WEEWX_UID} weewx \
|
|
|
|
&& adduser --system --uid ${WEEWX_UID} --ingroup weewx weewx
|
2022-01-30 22:11:34 +00:00
|
|
|
|
|
|
|
WORKDIR /tmp
|
|
|
|
COPY requirements.txt ./
|
|
|
|
|
2022-07-10 17:12:38 +00:00
|
|
|
# Python setup
|
|
|
|
RUN python -m venv /opt/venv
|
|
|
|
ENV PATH="/opt/venv/bin:$PATH"
|
|
|
|
RUN pip install --no-cache-dir --requirement requirements.txt
|
|
|
|
|
2022-07-15 18:29:23 +00:00
|
|
|
# Download weewx and plugins
|
2022-01-30 22:11:34 +00:00
|
|
|
RUN wget -O "${ARCHIVE}" "http://www.weewx.com/downloads/released_versions/${ARCHIVE}" &&\
|
2022-07-12 11:09:31 +00:00
|
|
|
wget -O weewx-interceptor.zip https://github.com/nifoc/weewx-interceptor/archive/refs/heads/feature/ecowitt-fields.zip &&\
|
2022-07-10 13:26:14 +00:00
|
|
|
wget -O weewx-forecast.zip https://github.com/chaunceygardiner/weewx-forecast/archive/master.zip &&\
|
2022-07-15 18:29:23 +00:00
|
|
|
wget -O weewx-wdc.zip https://github.com/Daveiano/weewx-wdc/releases/download/${WEEWX_WDC_VERSION}/weewx-wdc-${WEEWX_WDC_VERSION}.zip
|
2022-01-30 22:11:34 +00:00
|
|
|
|
2022-07-15 18:29:23 +00:00
|
|
|
# Extract weewx and (some) plugins
|
|
|
|
RUN tar --extract --gunzip --directory ${WEEWX_HOME} --strip-components=1 --file "${ARCHIVE}" &&\
|
|
|
|
mkdir weewx-wdc && unzip weewx-wdc.zip -d weewx-wdc
|
2022-01-30 22:11:34 +00:00
|
|
|
|
2022-07-15 18:29:23 +00:00
|
|
|
# weewx setup
|
|
|
|
RUN chown -R weewx:weewx ${WEEWX_HOME}
|
|
|
|
WORKDIR ${WEEWX_HOME}
|
2022-01-30 22:11:34 +00:00
|
|
|
RUN bin/wee_extension --install /tmp/weewx-interceptor.zip &&\
|
2022-07-10 13:26:14 +00:00
|
|
|
bin/wee_extension --install /tmp/weewx-forecast.zip &&\
|
2022-07-10 10:40:59 +00:00
|
|
|
bin/wee_extension --install /tmp/weewx-wdc &&\
|
2022-01-30 22:11:34 +00:00
|
|
|
mkdir user
|
|
|
|
COPY entrypoint.sh ./
|
2022-07-15 18:29:23 +00:00
|
|
|
COPY --chown=weewx:weewx user/ ./bin/user/
|
2022-01-30 22:11:34 +00:00
|
|
|
|
2022-07-15 18:29:23 +00:00
|
|
|
FROM python:3.10.5-slim-bullseye as final
|
2022-01-30 22:11:34 +00:00
|
|
|
|
2022-07-15 18:29:23 +00:00
|
|
|
ARG WEEWX_UID=421
|
2022-01-30 22:11:34 +00:00
|
|
|
ENV WEEWX_HOME="/home/weewx"
|
|
|
|
|
2022-07-15 18:29:23 +00:00
|
|
|
RUN addgroup --system --gid ${WEEWX_UID} weewx \
|
|
|
|
&& adduser --system --uid ${WEEWX_UID} --ingroup weewx weewx
|
2022-01-30 22:11:34 +00:00
|
|
|
|
2022-07-15 18:29:23 +00:00
|
|
|
# Install runtime dependencies
|
2022-01-30 22:11:34 +00:00
|
|
|
RUN apt-get update -qq -y &&\
|
2022-07-15 18:29:23 +00:00
|
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
|
|
|
libusb-1.0-0 \
|
|
|
|
gosu \
|
|
|
|
busybox-syslogd \
|
|
|
|
tzdata \
|
|
|
|
nginx-light -qq -y --no-install-recommends &&\
|
2022-01-30 22:11:34 +00:00
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2022-07-15 18:29:23 +00:00
|
|
|
# Copy installation from install stage
|
2022-01-30 22:11:34 +00:00
|
|
|
WORKDIR ${WEEWX_HOME}
|
2022-07-15 18:29:23 +00:00
|
|
|
COPY --from=install /opt/venv /opt/venv
|
|
|
|
COPY --from=install ${WEEWX_HOME} ${WEEWX_HOME}
|
2022-01-30 22:11:34 +00:00
|
|
|
|
|
|
|
RUN mkdir /data && \
|
|
|
|
cp weewx.conf /data
|
|
|
|
|
|
|
|
VOLUME ["/data"]
|
|
|
|
|
|
|
|
ENV PATH="/opt/venv/bin:$PATH"
|
|
|
|
ENTRYPOINT ["./entrypoint.sh"]
|
|
|
|
CMD ["/data/weewx.conf"]
|