summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Currey <ruscur@russell.cc>2019-05-01 16:27:17 +1000
committerDaniel Axtens <dja@axtens.net>2019-05-03 16:12:50 +1000
commit1ed898a9a8e52b72978dfa4d69c97f649f048d6d (patch)
tree446739d469176e70aea0d091002dd1a818f48b26
parentc56683dd8a738de544eeba137bf4ca12a5523054 (diff)
downloadpatchwork-1ed898a9a8e52b72978dfa4d69c97f649f048d6d.tar
patchwork-1ed898a9a8e52b72978dfa4d69c97f649f048d6d.tar.gz
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 <ruscur@russell.cc> Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Daniel Axtens <dja@axtens.net>
-rw-r--r--tools/docker/Dockerfile14
-rw-r--r--tools/docker/trusty-ports.list3
-rw-r--r--tools/docker/xenial-ports.list3
3 files changed, 18 insertions, 2 deletions
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