Change Debian->Alpine base container system.
This commit is contained in:
parent
0fd310d7ca
commit
63b4df5f5f
20
Dockerfile
20
Dockerfile
@ -1,15 +1,19 @@
|
|||||||
FROM debian:stretch-slim
|
#FROM debian:stretch-slim
|
||||||
RUN apt-get update && apt-get install -y python python-pip mosquitto git
|
#RUN apt-get update && apt-get install -y python python-pip mosquitto git
|
||||||
|
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
RUN apk update && apk upgrade
|
||||||
|
|
||||||
|
RUN apk add --update --no-cache python3 py3-pip py3-setuptools mosquitto git && \
|
||||||
|
if [ ! -e /usr/bin/python ]; then ln -f /usr/bin/python3 /usr/bin/python ; fi && \
|
||||||
|
if [ ! -e /usr/bin/pip ]; then ln -f /usr/bin/pip3 /usr/bin/pip ; fi
|
||||||
|
|
||||||
# Install paho-mqtt
|
|
||||||
RUN yes | pip install paho-mqtt
|
|
||||||
|
|
||||||
# Install paho-mqtt wrapper
|
# Install paho-mqtt wrapper
|
||||||
RUN git clone https://git.blackfinn.de/python/mqtt.git && \
|
RUN git clone https://git.blackfinn.de/python/mqtt.git && \
|
||||||
cd mqtt && \
|
cd mqtt && ./setup.py install && \
|
||||||
./setup.py install && \
|
rm -rf mqtt
|
||||||
cd .. && \
|
|
||||||
rm -rf mqtt
|
|
||||||
|
|
||||||
# Install mqtt-logger
|
# Install mqtt-logger
|
||||||
RUN git clone https://git.blackfinn.de/python/mqtt_logger.git
|
RUN git clone https://git.blackfinn.de/python/mqtt_logger.git
|
||||||
|
14
run.sh
14
run.sh
@ -1,17 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
/etc/init.d/mosquitto start
|
/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf -d
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
python /mqtt_logger/mqtt_logger/__init__.py
|
python /mqtt_logger/mqtt_logger/__init__.py
|
||||||
|
|
||||||
# if argument(s) given - execute argument(s) in container. Otherwise loop.
|
|
||||||
if [ "$#" -gt 0 ]; then
|
|
||||||
exec $@
|
|
||||||
else
|
|
||||||
while :;
|
|
||||||
do
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user