diff --git a/.image-gitlab-ci.yml b/.image-gitlab-ci.yml index 4deb67e..a9bc695 100644 --- a/.image-gitlab-ci.yml +++ b/.image-gitlab-ci.yml @@ -4,7 +4,7 @@ variables: IMAGE: {{ IMAGE }} PLATFORMS: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 REGISTRY: $REGISTRY_URI/$CI_PROJECT_PATH - TRIVY_VERSION: 0.53.0 + TRIVY_VERSION: 0.54.1 stages: - Static Code Analysis diff --git a/images/weewx/Dockerfile b/images/weewx/Dockerfile index 065b878..21ff90b 100644 --- a/images/weewx/Dockerfile +++ b/images/weewx/Dockerfile @@ -53,37 +53,34 @@ ARG WX_GROUP=dialout ARG WX_UID=2071 ARG AIRLINK_SHA=6392ee1d8e96a543306f16430ec9095b79dd7d0aacf8078171aa61b060a49745 +COPY install-input.txt entrypoint.sh log.conf /tmp RUN apk add --no-cache --update \ curl freetype libjpeg libstdc++ openssh openssl python3 py3-cheetah \ py3-configobj py3-mysqlclient py3-pillow py3-pymysql py3-pyserial \ - py3-requests py3-six py3-usb \ - rsync rsyslog tzdata && \ + py3-requests py3-six py3-usb rsync rsyslog tzdata && \ adduser -u $WX_UID -s /bin/sh -G $WX_GROUP -D $WX_USER && \ - apk add --no-cache --virtual .fetch-deps git && \ + mv /tmp/* /home/$WX_USER && \ + apk add --no-cache --virtual .fetch-deps gcc git musl-dev python3-dev && \ + VENV=/home/$WX_USER/weewx-venv && \ + python3 -m venv $VENV --system-site-packages && \ + source $VENV/bin/activate && \ + python3 -m pip install weewx && \ git clone -b $WEEGREEN_VERSION --depth 1 \ https://github.com/instantlinux/weewx-WeeGreen.git \ $WX_ROOT/skins/WeeGreen && \ - apk del .fetch-deps && \ chown $WX_USER $WX_ROOT && \ chown -R $WX_USER $WX_ROOT/skins && \ - rm -fr $WX_ROOT/skins/WeeGreen/.git && \ - find /usr/lib/python3* -name __pycache__ -exec rm -r '{}' +; - -COPY install-input.txt entrypoint.sh log.conf /home/$WX_USER -USER $WX_USER -RUN VENV=/home/$WX_USER/weewx-venv && \ - python3 -m venv $VENV --system-site-packages && \ - source $VENV/bin/activate && \ - python3 -m pip install weewx && \ - $VENV/bin/weectl station create < /home/$WX_USER/install-input.txt && \ + su $WX_USER -c \ + "$VENV/bin/weectl station create < /home/$WX_USER/install-input.txt" && \ cat /home/$WX_USER/log.conf >> $WX_ROOT/weewx.conf && \ curl -sLo /tmp/weewx-airlink.zip \ https://github.com/chaunceygardiner/weewx-airlink/releases/download/v$AIRLINK_VERSION/weewx-airlink-$AIRLINK_VERSION.zip && \ echo "$AIRLINK_SHA /tmp/weewx-airlink.zip" >> /tmp/checksums && \ sha256sum -c /tmp/checksums && \ - $VENV/bin/weectl extension install /tmp/weewx-airlink.zip --yes && \ - rm -fr /home/$WX_USER/.cache && \ - find $VENV -name __pycache__ -exec rm -r '{}' +; + su $WX_USER -c \ + "$VENV/bin/weectl extension install /tmp/weewx-airlink.zip --yes" && \ + apk del .fetch-deps && \ + rm -fr $WX_ROOT/skins/WeeGreen/.git /home/$WX_USER/.cache && \ + find /usr/lib/python3* $VENV -name __pycache__ -exec rm -r '{}' +; -USER root ENTRYPOINT ["/home/weewx/entrypoint.sh"]