From 0a2fa505744f568c8acab0a06c1c022db87e55d5 Mon Sep 17 00:00:00 2001 From: GP8x Date: Sun, 20 Aug 2017 14:58:04 +0100 Subject: [PATCH] update and minify Docker image --- Dockerfile | 38 +++++++++++++++----------------------- requirements.txt | 2 +- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9bc49f2..d20fad5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,21 @@ -FROM alpine:3.5 +FROM alpine:3.6 MAINTAINER Nat Morris -RUN apk add --update \ - python \ - python-dev \ - py-pip \ - build-base \ - && pip install virtualenv - -#ENV LIBRARY_PATH=/lib:/usr/lib -#RUN ln -s /usr/include/locale.h /usr/include/xlocale.h - -# Copy requirements before app so we can cache PIP dependencies on their own -RUN mkdir /app -COPY requirements.txt /app/requirements.txt -WORKDIR /app -RUN virtualenv /env && /env/bin/pip install -r /app/requirements.txt - +COPY requirements.txt /app/ COPY aaisp-to-mqtt.py /app/ +WORKDIR /app -RUN rm -rf \ - /root/.cache \ - /tmp/* -RUN rm -rf /var/cache/apk/* +RUN apk add --no-cache \ + python \ + ca-certificates \ + && apk add --no-cache --virtual .build-deps \ + py-pip \ + && pip install -r requirements.txt \ + && apk del .build-deps \ + && addgroup -g 1000 aaisp \ + && adduser -u 1000 -G aaisp -s /bin/sh -D aaisp \ + && chown aaisp:aaisp -R /app EXPOSE 8080/tcp - -CMD ["/env/bin/python", "/app/aaisp-to-mqtt.py", "-c /config/config.cfg"] +USER aaisp +CMD ["python", "aaisp-to-mqtt.py", "config.cfg"] diff --git a/requirements.txt b/requirements.txt index f5a7a66..e16a4d2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -paho-mqtt>=1.2,<1.3 +paho-mqtt>=1.2 configparser>=3.5.0 humanfriendly>=2.1