]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
docker: Use Ubuntu ports repositories on non-x86 architectures
authorRussell Currey <ruscur@russell.cc>
Wed, 1 May 2019 06:27:17 +0000 (16:27 +1000)
committerDaniel Axtens <dja@axtens.net>
Fri, 3 May 2019 06:12:50 +0000 (16:12 +1000)
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@russell.cc>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Daniel Axtens <dja@axtens.net>
tools/docker/Dockerfile
tools/docker/trusty-ports.list [new file with mode: 0644]
tools/docker/xenial-ports.list [new file with mode: 0644]

index eef40e45c194a95b687580a688cd891a76cc79fc..76bb6b2bcb898b434d84d44b73e001952064e6bf 100644 (file)
@@ -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 (file)
index 0000000..ebcf4fa
--- /dev/null
@@ -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 (file)
index 0000000..d84641f
--- /dev/null
@@ -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