[PATCH 1/2] docker: Use Ubuntu ports repositories on non-x86 architectures

Andrew Donnellan andrew.donnellan at au1.ibm.com
Wed May 1 17:35:08 AEST 2019


On 1/5/19 4:27 pm, Russell Currey wrote:
> 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 <ruscur at russell.cc>

Gross, but alas. One day ppc64le will graduate to being mirrored like a 
real architecture...

Reviewed-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>

> ---
>   tools/docker/Dockerfile        | 14 ++++++++++++--
>   tools/docker/trusty-ports.list |  3 +++
>   tools/docker/xenial-ports.list |  3 +++
>   3 files changed, 18 insertions(+), 2 deletions(-)
>   create mode 100644 tools/docker/trusty-ports.list
>   create mode 100644 tools/docker/xenial-ports.list
> 
> diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
> index eef40e4..76bb6b2 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 0000000..ebcf4fa
> --- /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 0000000..d84641f
> --- /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
> 

-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan at au1.ibm.com  IBM Australia Limited



More information about the Patchwork mailing list