diff --git a/Dockerfile b/Dockerfile index 685e718..9bc49f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,29 @@ -FROM phusion/baseimage:0.9.19 -MAINTAINER Nat Morris "nat@nuqe.net" +FROM alpine:3.5 +MAINTAINER Nat Morris -COPY aaisp-to-mqtt.py /usr/local/bin/aaisp-to-mqtt.py +RUN apk add --update \ + python \ + python-dev \ + py-pip \ + build-base \ + && pip install virtualenv -RUN apt-get update -RUN apt-get install -y python-pip python-dev libffi-dev libssl-dev -ADD requirements.txt /tmp -RUN pip install --upgrade -r /tmp/requirements.txt +#ENV LIBRARY_PATH=/lib:/usr/lib +#RUN ln -s /usr/include/locale.h /usr/include/xlocale.h -RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +# 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 aaisp-to-mqtt.py /app/ + +RUN rm -rf \ + /root/.cache \ + /tmp/* +RUN rm -rf /var/cache/apk/* + +EXPOSE 8080/tcp + +CMD ["/env/bin/python", "/app/aaisp-to-mqtt.py", "-c /config/config.cfg"]