-
Notifications
You must be signed in to change notification settings - Fork 1
/
python.mqtt2sql.alpine.Dockerfile
46 lines (38 loc) · 1.37 KB
/
python.mqtt2sql.alpine.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
FROM python:3.13-alpine
ARG VCS_REF
ARG BUILD_DATE
LABEL org.opencontainers.image.authors="Tobias Hargesheimer <[email protected]>" \
org.opencontainers.image.title="PI-Sensors" \
org.opencontainers.image.description="Raspberry Pi GPIO Sensors (AlpineLinux with Python 3)" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.created="${BUILD_DATE}" \
org.opencontainers.image.revision="${VCS_REF}" \
org.opencontainers.image.url="https://hub.docker.com/r/tobi312/rpi-sensors/" \
org.opencontainers.image.source="https://github.com/Tob1as/rpi-sensors"
SHELL ["/bin/sh", "-euxo", "pipefail", "-c"]
#COPY *.py /service/
COPY mqtt2sql.py /service/
RUN \
addgroup --gid 1000 service ; \
adduser --system --shell /bin/sh --uid 1000 --ingroup service --home /service service ; \
\
#mkdir /service ; \
apk add --no-cache --virtual .build-deps \
gcc libc-dev \
mariadb-connector-c-dev \
; \
apk add --no-cache \
mariadb-connector-c \
; \
pip3 install --no-cache-dir mariadb==1.1.10; \
pip3 install --no-cache-dir paho-mqtt==2.1.0; \
apk del --no-network --purge .build-deps; \
chmod +x /service/*.py ; \
\
mkdir /data ; \
chmod 777 /data ; \
chown -R service:service /data
WORKDIR /data
USER service
STOPSIGNAL SIGINT
CMD ["python3", "-u", "/service/mqtt2sql.py"]