cleanup mitmproxy

Signed-off-by: Jess Frazelle <acidburn@github.com>
diff --git a/latest-versions.sh b/latest-versions.sh
index 0d97bdd..419bec7 100755
--- a/latest-versions.sh
+++ b/latest-versions.sh
@@ -121,6 +121,7 @@
 robertdavidgraham/masscan
 MidnightCommander/mc
 zyedidia/micro
+mitmproxy/mitmproxy
 hashicorp/nomad
 zeit/now-cli
 nzbget/nzbget
diff --git a/mitmproxy/Dockerfile b/mitmproxy/Dockerfile
index 45e5d36..c2368a1 100644
--- a/mitmproxy/Dockerfile
+++ b/mitmproxy/Dockerfile
@@ -1,50 +1,29 @@
-FROM alpine:latest
+FROM debian:buster-slim
 LABEL maintainer "Jessie Frazelle <jess@linux.com>"
+
 ENV LANG=en_US.UTF-8
 
-COPY requirements.txt /tmp/requirements.txt
+RUN apt-get update && apt-get install -y \
+	ca-certificates \
+	curl \
+	--no-install-recommends \
+	&& rm -rf /var/lib/apt/lists/*
 
-# add our user first to make sure the ID get assigned consistently,
-# regardless of whatever dependencies get added
-RUN addgroup -S mitmproxy && adduser -S -G mitmproxy mitmproxy \
-    && apk add --no-cache \
-        su-exec \
-        git \
-        g++ \
-        libffi \
-        libffi-dev \
-        libjpeg-turbo \
-        libjpeg-turbo-dev \
-        libstdc++ \
-        libxml2 \
-        libxml2-dev \
-        libxslt \
-        libxslt-dev \
-        openssl \
-        openssl-dev \
-        python3 \
-        python3-dev \
-        zlib \
-        zlib-dev \
-    && python3 -m ensurepip \
-    && LDFLAGS=-L/lib pip3 install -r /tmp/requirements.txt \
-    && apk del --purge \
-        git \
-        g++ \
-        libffi-dev \
-        libjpeg-turbo-dev \
-        libxml2-dev \
-        libxslt-dev \
-        openssl-dev \
-        python3-dev \
-        zlib-dev \
-    && rm /tmp/requirements.txt \
-    && rm -rf ~/.cache/pip
+# Add our user first to make sure the ID get assigned consistently,
+# regardless of whatever dependencies get added.
+RUN groupadd -r mitmproxy && useradd -r -g mitmproxy mitmproxy \
+    && mkdir -p /home/mitmproxy/.mitmproxy \
+	&& chown -R mitmproxy:mitmproxy /home/mitmproxy
+
+# Download the binaries.
+ENV MITMPROXY_VERSION 4.0.4
+RUN curl -sSL "https://snapshots.mitmproxy.org/${MITMPROXY_VERSION}/mitmproxy-${MITMPROXY_VERSION}-linux.tar.gz" | tar -vxzC /usr/local/bin
 
 VOLUME /home/mitmproxy/.mitmproxy
 
 COPY docker-entrypoint.sh /usr/local/bin/
-ENTRYPOINT ["docker-entrypoint.sh"]
 
 EXPOSE 8080 8081
+
+ENTRYPOINT ["docker-entrypoint.sh"]
 CMD ["mitmproxy"]
diff --git a/mitmproxy/docker-entrypoint.sh b/mitmproxy/docker-entrypoint.sh
index c299848..170cdbc 100755
--- a/mitmproxy/docker-entrypoint.sh
+++ b/mitmproxy/docker-entrypoint.sh
@@ -4,10 +4,10 @@
 MITMPROXY_PATH="/home/mitmproxy/.mitmproxy"
 
 if [ "$1" = "mitmdump" ] || [ "$1" = "mitmproxy" ] || [ "$1" = "mitmweb" ]; then
-        mkdir -p "$MITMPROXY_PATH"
-        chown -R mitmproxy:mitmproxy "$MITMPROXY_PATH"
+	mkdir -p "$MITMPROXY_PATH"
+	chown -R mitmproxy:mitmproxy "$MITMPROXY_PATH"
 
-        su-exec mitmproxy "$@"
+	su mitmproxy -c "$@"
 else
-        exec "$@"
+	exec "$@"
 fi
diff --git a/mitmproxy/requirements.txt b/mitmproxy/requirements.txt
deleted file mode 100644
index 59bcb3f..0000000
--- a/mitmproxy/requirements.txt
+++ /dev/null
@@ -1 +0,0 @@
-git+https://github.com/mitmproxy/mitmproxy.git@master