From: Russell Currey Date: Wed, 1 May 2019 06:27:17 +0000 (+1000) Subject: docker: Use Ubuntu ports repositories on non-x86 architectures X-Git-Tag: v2.2.0-rc1~122 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ed898a9a8e52b72978dfa4d69c97f649f048d6d;p=thirdparty%2Fpatchwork.git docker: Use Ubuntu ports repositories on non-x86 architectures This should allow Patchwork to run "out of the box" in Docker on any architecture with a) an Ubuntu port and b) support in the Postgres multiarch Docker image, which includes at least arm64 and ppc64le. It's a little gross hacking the Dockerfile like this, but I'm not sure there's a more elegant way to do it. Unfortunately it doesn't seem like there's any way to do conditional COPY, and anything in RUN is plain /bin/sh, so that's why it looks like it does. Tested on ppc64le and on x86_64. Signed-off-by: Russell Currey Reviewed-by: Andrew Donnellan Signed-off-by: Daniel Axtens --- diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index eef40e45..76bb6b2b 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -15,11 +15,21 @@ ENV DJANGO_SETTINGS_MODULE patchwork.settings.dev ENV DEBIAN_FRONTEND noninteractive ENV PYTHONUNBUFFERED 1 + # System # trusty and findutils is for python3.4; xenial is for python3.5 # TODO(stephenfin): Are curl, unzip required? -COPY tools/docker/trusty.list /etc/apt/sources.list.d/trusty.list -COPY tools/docker/xenial.list /etc/apt/sources.list.d/xenial.list +COPY tools/docker/*.list /etc/apt/sources.list.d/ + +RUN cd /etc/apt/sources.list.d; \ + echo $(uname -m) > /tmp/arch; \ + if [ $(cat /tmp/arch) != 'x86_64' ] && grep -q -v "i.86" /tmp/arch; then \ + mv trusty-ports.list trusty.list; \ + mv xenial-ports.list xenial.list; \ + else \ + rm *-ports.list; \ + fi + RUN apt-get update -qq && \ apt-get install -y --no-install-recommends --allow-downgrades \ python-dev python-pip python-setuptools python-wheel \ diff --git a/tools/docker/trusty-ports.list b/tools/docker/trusty-ports.list new file mode 100644 index 00000000..ebcf4fa4 --- /dev/null +++ b/tools/docker/trusty-ports.list @@ -0,0 +1,3 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ trusty main +deb http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main +deb http://ports.ubuntu.com/ubuntu-ports/ trusty-security main diff --git a/tools/docker/xenial-ports.list b/tools/docker/xenial-ports.list new file mode 100644 index 00000000..d84641fa --- /dev/null +++ b/tools/docker/xenial-ports.list @@ -0,0 +1,3 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ xenial main +deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main +deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main