From 63b4df5f5f7e28f055e95f7b086a10601781d980 Mon Sep 17 00:00:00 2001 From: Thomas Klaehn Date: Wed, 14 Aug 2019 16:26:00 +0200 Subject: [PATCH] Change Debian->Alpine base container system. --- Dockerfile | 20 ++++++++++++-------- run.sh | 14 ++------------ 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index 009e070..305080e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,19 @@ -FROM debian:stretch-slim -RUN apt-get update && apt-get install -y python python-pip mosquitto git +#FROM debian:stretch-slim +#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 RUN git clone https://git.blackfinn.de/python/mqtt.git && \ - cd mqtt && \ - ./setup.py install && \ - cd .. && \ - rm -rf mqtt + cd mqtt && ./setup.py install && \ + rm -rf mqtt # Install mqtt-logger RUN git clone https://git.blackfinn.de/python/mqtt_logger.git diff --git a/run.sh b/run.sh index c47c92b..6fcf28a 100755 --- a/run.sh +++ b/run.sh @@ -1,17 +1,7 @@ -#!/bin/bash -/etc/init.d/mosquitto start +#!/bin/sh +/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf -d sleep 1 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 -