Switch Docker release to be based on Debian instead of Alpine (#4493)

This commit is contained in:
Peter Dave Hello 2021-03-11 23:49:07 +08:00 committed by GitHub
parent 70223163de
commit 27ba85bc30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 30 deletions

View File

@ -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.

View File

@ -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

View File

@ -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