update dockerfile with oled supported

This commit is contained in:
2019-06-02 22:56:39 +10:00
parent 06e77f7ebf
commit 0928a5be65
2 changed files with 14 additions and 5 deletions
+13 -4
View File
@@ -1,9 +1,18 @@
FROM arm32v7/python:alpine
WORKDIR /code
# linux-headers fix the issue of "spidev_module.c:33:10: fatal error: linux/spi/spidev.h: No such file or directory
#include <linux/spi/spidev.h>"
RUN apk update \
&& apk add --update --no-cache alpine-sdk py-pip libusb-dev\
&& pip install RPi.GPIO pyusb
&& apk add --update --no-cache alpine-sdk build-base linux-headers py-pip libusb-dev python-dev \
py3-setuptools zlib-dev
VOLUME [ "/code" ]
RUN python -m pip install --upgrade pip setuptools \
&& pip install RPi.GPIO pyusb smbus2 Adafruit-SSD1306
CMD python code/x.py
RUN pip install pillow --global-option="build_ext" --global-option="--disable-jpeg"
ADD x.py /code
CMD python x.py
+1 -1
View File
@@ -107,7 +107,7 @@ def draw_stats(disp, draw, image):
draw.rectangle((0, 0, width, height), outline=0, fill=0)
# Shell scripts for system monitoring from here : https://unix.stackexchange.com/questions/119126/command-to-display-memory-usage-disk-usage-and-cpu-load
cmd = "hostname -I | cut -d' ' -f1"
cmd = "hostname -i | cut -d' ' -f1"
IP = subprocess.check_output(cmd, shell=True)
cmd = "top -bn1 | grep load | awk '{printf \"CPU Load: %.2f\", $(NF-2)}'"
CPU = subprocess.check_output(cmd, shell=True)