mirror of
https://github.com/wahyd4/raspberry-pi.git
synced 2026-08-08 20:36:36 +10:00
update dockerfile with oled supported
This commit is contained in:
+13
-4
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user