Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SYS-623 fix and publish multi-platform weewx image #166

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .image-gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 15 additions & 18 deletions images/weewx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Loading