From aeb772e741c1b42813b7e3d7a8bdffeaeef9bbec Mon Sep 17 00:00:00 2001 From: marcymarcy Date: Tue, 5 Jun 2018 14:12:11 -0600 Subject: [PATCH 1/5] Dockerfile for Raspberry Pi 3 --- docker/DockerfileARMv7 | 45 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 docker/DockerfileARMv7 diff --git a/docker/DockerfileARMv7 b/docker/DockerfileARMv7 new file mode 100644 index 000000000..2988b5e4d --- /dev/null +++ b/docker/DockerfileARMv7 @@ -0,0 +1,45 @@ +FROM resin/raspberrypi3-alpine:3.7 + +ENV LANG=en_US.UTF-8 + +ARG WHEEL_MITMPROXY +ARG WHEEL_BASENAME_MITMPROXY + +COPY $WHEEL_MITMPROXY /home/mitmproxy/ + +RUN [ "cross-build-start" ] + +# 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 \ + && 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 [ "cross-build-end" ] + +VOLUME /home/mitmproxy/.mitmproxy + +COPY docker/docker-entrypoint.sh /usr/local/bin/ +ENTRYPOINT ["docker-entrypoint.sh"] + +EXPOSE 8080 8081 + +CMD ["mitmproxy"] From d80271c6417d0cdf24c7d9e5c89b1112b5fa5e09 Mon Sep 17 00:00:00 2001 From: marcymarcy Date: Tue, 5 Jun 2018 14:12:32 -0600 Subject: [PATCH 2/5] Adding ARMv7 into build --- release/cibuild.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/release/cibuild.py b/release/cibuild.py index 17fb85545..201a94b66 100755 --- a/release/cibuild.py +++ b/release/cibuild.py @@ -299,6 +299,18 @@ def build_docker_image(be: BuildEnviron, whl: str): # pragma: no cover ]) +def build_docker_image(be: BuildEnviron, whl: str): # pragma: no cover + click.echo("Building ARMv7 Docker image...") + subprocess.check_call([ + "docker", + "build", + "--tag", be.docker_tag + "ARMv7", + "--build-arg", "WHEEL_MITMPROXY={}".format(whl), + "--build-arg", "WHEEL_BASENAME_MITMPROXY={}".format(os.path.basename(whl)), + "--file", "docker/DockerfileARMv7", + "." + ]) + def build_pyinstaller(be: BuildEnviron): # pragma: no cover click.echo("Building pyinstaller package...") @@ -499,6 +511,16 @@ def upload(): # pragma: no cover ]) subprocess.check_call(["docker", "push", be.docker_tag]) + if be.should_upload_docker: + click.echo("Uploading ARMv7 Docker image to tag={}...".format(be.docker_tag + "ARMv7")) + subprocess.check_call([ + "docker", + "login", + "-u", be.docker_username, + "-p", be.docker_password, + ]) + subprocess.check_call(["docker", "push", be.docker_tag + "ARMv7"]) + if __name__ == "__main__": # pragma: no cover cli() From 2af9d2031259f3928b9266e35534af71f5842cf9 Mon Sep 17 00:00:00 2001 From: marcymarcy Date: Wed, 6 Jun 2018 09:49:57 -0600 Subject: [PATCH 3/5] Renaming function, formatting fix --- release/cibuild.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release/cibuild.py b/release/cibuild.py index 201a94b66..e36fe8bcf 100755 --- a/release/cibuild.py +++ b/release/cibuild.py @@ -299,7 +299,7 @@ def build_docker_image(be: BuildEnviron, whl: str): # pragma: no cover ]) -def build_docker_image(be: BuildEnviron, whl: str): # pragma: no cover +def build_docker_arm_image(be: BuildEnviron, whl: str): # pragma: no cover click.echo("Building ARMv7 Docker image...") subprocess.check_call([ "docker", @@ -311,6 +311,7 @@ def build_docker_image(be: BuildEnviron, whl: str): # pragma: no cover "." ]) + def build_pyinstaller(be: BuildEnviron): # pragma: no cover click.echo("Building pyinstaller package...") From 4a25efda82f8c5068e1d0a71ae67843020154a79 Mon Sep 17 00:00:00 2001 From: marcymarcy Date: Wed, 6 Jun 2018 10:39:19 -0600 Subject: [PATCH 4/5] Using subprocesses --- release/cibuild.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/release/cibuild.py b/release/cibuild.py index e36fe8bcf..8575ad5c4 100755 --- a/release/cibuild.py +++ b/release/cibuild.py @@ -287,7 +287,7 @@ def build_wheel(be: BuildEnviron): # pragma: no cover def build_docker_image(be: BuildEnviron, whl: str): # pragma: no cover - click.echo("Building Docker image...") + click.echo("Building Docker images...") subprocess.check_call([ "docker", "build", @@ -297,10 +297,6 @@ def build_docker_image(be: BuildEnviron, whl: str): # pragma: no cover "--file", "docker/Dockerfile", "." ]) - - -def build_docker_arm_image(be: BuildEnviron, whl: str): # pragma: no cover - click.echo("Building ARMv7 Docker image...") subprocess.check_call([ "docker", "build", From e98100e461ac39246b634add1ddde4d3415bdd3d Mon Sep 17 00:00:00 2001 From: marcymarcy Date: Wed, 6 Jun 2018 11:01:49 -0600 Subject: [PATCH 5/5] Combining Docker push steps, clarifying tag name --- release/cibuild.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/release/cibuild.py b/release/cibuild.py index 8575ad5c4..2d11d69a3 100755 --- a/release/cibuild.py +++ b/release/cibuild.py @@ -300,7 +300,7 @@ def build_docker_image(be: BuildEnviron, whl: str): # pragma: no cover subprocess.check_call([ "docker", "build", - "--tag", be.docker_tag + "ARMv7", + "--tag", be.docker_tag + "-ARMv7", "--build-arg", "WHEEL_MITMPROXY={}".format(whl), "--build-arg", "WHEEL_BASENAME_MITMPROXY={}".format(os.path.basename(whl)), "--file", "docker/DockerfileARMv7", @@ -507,16 +507,7 @@ def upload(): # pragma: no cover "-p", be.docker_password, ]) subprocess.check_call(["docker", "push", be.docker_tag]) - - if be.should_upload_docker: - click.echo("Uploading ARMv7 Docker image to tag={}...".format(be.docker_tag + "ARMv7")) - subprocess.check_call([ - "docker", - "login", - "-u", be.docker_username, - "-p", be.docker_password, - ]) - subprocess.check_call(["docker", "push", be.docker_tag + "ARMv7"]) + subprocess.check_call(["docker", "push", be.docker_tag + "-ARMv7"]) if __name__ == "__main__": # pragma: no cover