Browse Source

container image: fix build on arm

Fabian Peter Hammerle 5 months ago
parent
commit
137130b030
2 changed files with 8 additions and 3 deletions
  1. 1 1
      CHANGELOG.md
  2. 7 2
      Dockerfile

+ 1 - 1
CHANGELOG.md

@@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ### Changed
 - TLS now enabled by default (disable via `--mqtt-disable-tls`)
 - require `PySwitchbot>=0.14.0,<0.41` instead of `PySwitchbot>=0.10.0,<0.13`
-- `--fetch-device-info` not longer requires `CAP_NET_ADMIN`
+- `--fetch-device-info` no longer requires `CAP_NET_ADMIN`
   (bluepy-helper replaced with bleak)
 - replaced [paho-mqtt](https://github.com/eclipse/paho.mqtt.python)
   with its async wrapper [aiomqtt](https://github.com/sbtinstruments/aiomqtt)

+ 7 - 2
Dockerfile

@@ -10,15 +10,19 @@ ARG SOURCE_DIR_PATH=/switchbot-mqtt
 FROM $BASE_IMAGE as build
 
 RUN apk add --no-cache \
+        cargo `# cryptography build` \
         gcc \
         git `# setuptools_scm` \
         glib-dev \
         jq `# edit Pipfile.lock` \
         make \
         musl-dev \
+        openssl-dev `# cryptography build` \
         py3-certifi `# pipenv` \
         py3-pip `# pipenv install` \
         py3-virtualenv `# pipenv` \
+        python3-dev `# Python.h for cffi build` \
+        rust `# cryptography build` \
     && adduser -S build
 
 USER build
@@ -33,9 +37,10 @@ ENV PIPENV_CACHE_DIR=/tmp/pipenv-cache \
 # `sponge` is not pre-installed
 RUN jq 'del(.default."switchbot-mqtt", .default."sanitized-package")' Pipfile.lock > Pipfile.lock~ \
     && mv Pipfile.lock~ Pipfile.lock \
-    && pipenv install --deploy --verbose
+    && pipenv install --deploy
 COPY --chown=build:nobody . $SOURCE_DIR_PATH
-RUN pipenv install --deploy --verbose \
+RUN if ! git status; then export SETUPTOOLS_SCM_PRETEND_VERSION=0.0.0; fi \
+    && pipenv install --deploy \
     && pipenv graph \
     && pipenv run pip freeze \
     && rm -rf .git/ $PIPENV_CACHE_DIR \