Switch Docker release to be based on Debian instead of Alpine
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c0901cbe1a..86543af234 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -57,6 +57,7 @@ If you depend on these features, please raise your voice in
 * Fix SNI-related reproducibility issues when exporting to curl/httpie commands. (@dkasak)
 * Add option `export_preserve_original_ip` to force exported command to connect to IP from original request. Only supports curl at the moment. (@dkasak)
 * Major proxy protocol testing (@r00t-)
+* Switch Docker image release to be based on Debian (@PeterDaveHello)
 * --- TODO: add new PRs above this line ---
 * ... and various other fixes, documentation improvements, dependency version bumps, etc.
 
diff --git a/release/docker/Dockerfile b/release/docker/Dockerfile
index 0e9ef3fd0f..3916cabd06 100644
--- a/release/docker/Dockerfile
+++ b/release/docker/Dockerfile
@@ -1,36 +1,16 @@
-FROM alpine:3.12
-
-ENV LANG=en_US.UTF-8
+FROM python:3.9-slim-buster
 
 ARG WHEEL_MITMPROXY
 ARG WHEEL_BASENAME_MITMPROXY
 
+RUN useradd -mU mitmproxy
+RUN apt-get update \
+    && apt-get install -y gosu \
+    && rm -rf /var/lib/apt/lists/*
+    
 COPY $WHEEL_MITMPROXY /home/mitmproxy/
-
-# 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 \
-        libstdc++ \
-        openssl \
-        openssl-dev \
-        python3 \
-        python3-dev \
-    && python3 -m ensurepip --upgrade \
-    && pip3 install -U pip \
-    && LDFLAGS=-L/lib pip3 install -U /home/mitmproxy/${WHEEL_BASENAME_MITMPROXY} \
-    && apk del --purge \
-        git \
-        g++ \
-        libffi-dev \
-        openssl-dev \
-        python3-dev \
-    && rm -rf ~/.cache/pip /home/mitmproxy/${WHEEL_BASENAME_MITMPROXY}
+RUN pip3 install --no-cache-dir -U /home/mitmproxy/${WHEEL_BASENAME_MITMPROXY} \
+    && rm -rf /home/mitmproxy/${WHEEL_BASENAME_MITMPROXY}
 
 VOLUME /home/mitmproxy/.mitmproxy
 
diff --git a/release/docker/docker-entrypoint.sh b/release/docker/docker-entrypoint.sh
index 84ea81e6a9..1f267d2f31 100755
--- a/release/docker/docker-entrypoint.sh
+++ b/release/docker/docker-entrypoint.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # WARNING: do not change the shebang - the Docker base image might not have what you want!
 
 set -o errexit
@@ -11,7 +11,7 @@ MITMPROXY_PATH="/home/mitmproxy/.mitmproxy"
 if [[ "$1" = "mitmdump" || "$1" = "mitmproxy" || "$1" = "mitmweb" ]]; then
   mkdir -p "$MITMPROXY_PATH"
   chown -R mitmproxy:mitmproxy "$MITMPROXY_PATH"
-  su-exec mitmproxy "$@"
+  gosu mitmproxy "$@"
 else
   exec "$@"
 fi

#### Description

As @mhils invited, help rewrite the Docker image to replace Alpine Linux. The final image size is about 179MB, compared with original 123MB, should be not too big :D

It's a large rewrite and I'm not very familiar with mitmproxy, so please help test its functionality to be as expected, thanks.

fix #3712

#### Checklist

 - [ ] I have updated tests where applicable.
 - [x] I have added an entry to the CHANGELOG.
