Merge pull request #3190 from realeyes-media/master

Adding Docker build for Raspberry Pi 3 (ARMv7 Processor Family)
This commit is contained in:
Aldo Cortesi 2018-06-13 09:19:42 +12:00 committed by GitHub
commit d36b5aaada
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 56 additions and 1 deletions

45
docker/DockerfileARMv7 Normal file
View File

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

View File

@ -287,7 +287,7 @@ def build_wheel(be: BuildEnviron): # pragma: no cover
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 Docker image...") click.echo("Building Docker images...")
subprocess.check_call([ subprocess.check_call([
"docker", "docker",
"build", "build",
@ -297,6 +297,15 @@ def build_docker_image(be: BuildEnviron, whl: str): # pragma: no cover
"--file", "docker/Dockerfile", "--file", "docker/Dockerfile",
"." "."
]) ])
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 def build_pyinstaller(be: BuildEnviron): # pragma: no cover
@ -498,6 +507,7 @@ def upload(): # pragma: no cover
"-p", be.docker_password, "-p", be.docker_password,
]) ])
subprocess.check_call(["docker", "push", be.docker_tag]) subprocess.check_call(["docker", "push", be.docker_tag])
subprocess.check_call(["docker", "push", be.docker_tag + "-ARMv7"])
if __name__ == "__main__": # pragma: no cover if __name__ == "__main__": # pragma: no cover