Skip to content

Commit

Permalink
Switch Docker release to be based on Debian instead of Alpine (#4493)
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterDaveHello committed Mar 11, 2021
1 parent 7022316 commit 27ba85b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 30 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
36 changes: 8 additions & 28 deletions release/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions release/docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

0 comments on commit 27ba85b

Please sign in to comment.