@@ -11,7 +11,7 @@ FROM debian:bookworm-slim
1111 ENV LANG=en_US.UTF-8
1212
1313 # Define build-time dependencies that can be removed after build
14- ARG BUILD_DEPS="wget unzip git python3-dev libffi-dev libjpeg-dev"
14+ ARG BUILD_DEPS="wget unzip git python3-dev libffi-dev libjpeg-dev gcc g++ build-essential zlib1g-dev "
1515
1616 RUN apt-get update \
1717 && apt-get install --no-install-recommends -y \
@@ -39,9 +39,9 @@ FROM debian:bookworm-slim
3939 USER weewx
4040
4141 RUN python3 -m venv /home/weewx/weewx-venv \
42- && chmod -R 755 /home/weewx \
43- && . /home/weewx/weewx-venv/bin/activate \
44- # Install all pip packages in one command with --no-cache-dir
42+ && chmod -R 755 /home/weewx
43+
44+ RUN . /home/weewx/weewx-venv/bin/activate \
4545 && python3 -m pip install --no-cache-dir \
4646 Pillow \
4747 CT3 \
@@ -52,20 +52,19 @@ FROM debian:bookworm-slim
5252 ephem \
5353 PyMySQL \
5454 db-sqlite3 \
55- requests \
56- && git clone https://github.com/weewx/weewx ~/weewx \
55+ requests
56+
57+ RUN git clone https://github.com/weewx/weewx ~/weewx \
5758 && cd ~/weewx \
5859 && git checkout $TAG \
59- # Remove git history to save space
6060 && rm -rf ~/weewx/.git \
61- # Remove docs, tests, and other unnecessary files
62- && rm -rf ~/weewx/docs ~/weewx/tests ~/weewx/.github \
63- && . /home/weewx/weewx-venv/bin/activate \
64- && python3 ~/weewx/src/weectl.py station create --no-prompt \
65- # Clean up Python bytecode
61+ && rm -rf ~/weewx/docs ~/weewx/tests ~/weewx/.github ~/weewx/examples \
6662 && find /home/weewx/weewx-venv -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true \
6763 && find /home/weewx/weewx-venv -type f -name '*.pyc' -delete 2>/dev/null || true
6864
65+ RUN . /home/weewx/weewx-venv/bin/activate \
66+ && python3 ~/weewx/src/weectl.py station create --no-prompt
67+
6968 COPY conf-fragments/*.conf /home/weewx/tmp/conf-fragments/
7069 RUN mkdir -p /home/weewx/tmp \
7170 && mkdir -p /home/weewx/weewx-data \
0 commit comments