IMAGE taarifa_0.2.0-210124
FROM alpine3.12-python3.8_3.8.5-210106

RUN EOF
    # Install runtime dependencies
    apk --no-cache add nginx 
    
    # Install build dependencies
    apk --no-cache add --virtual .deps git

    # Install Taarifa
    mkdir /srv/taarifa
    wget https://github.com/trendspotter/TaarifaWaterpoints/releases/download/0.2/TaarifaWaterpoints-0.2.tar.xz -O - | tar xJf - -C /srv/taarifa
    pip3 install -r /srv/taarifa/requirements.txt
    mv src/taarifaapi/taarifa_api /usr/lib/python3.8/site-packages/taarifa_api

    # Create OS user
    addgroup -S -g 8080 taarifa
    adduser -S -u 8080 -h /srv/taarifa -s /bin/false -g taarifa -G taarifa taarifa
    chown -R taarifa:taarifa /srv/taarifa

    # Cleanup
    apk --no-cache del .deps
    rm -rf /root/.cache /src
EOF

COPY image.d

CMD /bin/s6-svscan /etc/services.d
