aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-01-25 22:46:15 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-01-26 02:19:26 +0300
commit338a08a0ee2f7d4abb26d9d6c172adead333ea74 (patch)
tree699542e88ec72a482d1a1b4dbdcaf39c3ed325e2
parentTravis: push Docker images (diff)
downloadfr24feed-338a08a0ee2f7d4abb26d9d6c172adead333ea74.tar.gz
fr24feed-338a08a0ee2f7d4abb26d9d6c172adead333ea74.zip
Travis: multiarch builds
-rw-r--r--.travis.yml41
-rw-r--r--fr24feed/Dockerfile37
2 files changed, 61 insertions, 17 deletions
diff --git a/.travis.yml b/.travis.yml
index 36aee92..61555a5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,13 +1,40 @@
+# I used this guide to set up multiarch builds:
+# https://mirailabs.io/blog/multiarch-docker-with-buildx/
+# I don't understand it completely at the moment, but whatever.
+
+# TODO: Docker Hub automated builds instead of Travis?
+# TODO: docker-compose instead of docker buildx?
+
language: minimal
os: linux
dist: bionic
-arch: arm64
+
services:
- docker
+
+addons:
+ apt:
+ update: true
+ # Newer docker for buildx support:
+ sources:
+ - key_url: 'https://download.docker.com/linux/ubuntu/gpg'
+ sourceline: 'deb https://download.docker.com/linux/ubuntu "$(lsb_release -cs)" stable'
+ packages:
+ - docker-ce
+
+env:
+ # Enable experimental buildx support
+ DOCKER_CLI_EXPERIMENTAL: enabled
+ platforms: linux/i386,linux/amd64,linux/armhf
+
script:
- - docker-compose build
-deploy:
- provider: script
- on:
- branch: master
- script: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin && docker-compose push
+ - docker run --rm --privileged docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d
+ - docker buildx create --use
+ - docker buildx build --platform "$platforms" dump1090/
+ - docker buildx build --platform "$platforms" fr24feed/
+ - |-
+ if [ "$TRAVIS_BRANCH" = master ]; then
+ echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
+ docker buildx build --platform "$platforms" -t "$DOCKER_USERNAME/dump1090" --push dump1090/
+ docker buildx build --platform "$platforms" -t "$DOCKER_USERNAME/fr24feed" --push fr24feed/
+ fi
diff --git a/fr24feed/Dockerfile b/fr24feed/Dockerfile
index 63eee4f..07c00d3 100644
--- a/fr24feed/Dockerfile
+++ b/fr24feed/Dockerfile
@@ -1,10 +1,33 @@
# Alpine is a bit too extreme (it doesn't have /etc/localtime, no support for
# hostname -I, etc.).
-FROM debian:stretch-slim
+FROM debian:stretch-slim AS base
+
+# Those are weird hacks, but the alternative (using the apt repository) was
+# unsuitable (no systemctl, etc.).
+
+FROM base as base-386
+ENV fr24feed_directory=linux_x86_binaries
+ENV fr24feed_version=1.0.24-5
+ENV fr24feed_archive_suffix=i386
+
+FROM base AS base-amd64
+ENV fr24feed_directory=linux_x86_64_binaries
+ENV fr24feed_version=1.0.24-5
+ENV fr24feed_archive_suffix=amd64
+
+FROM base AS base-arm
+ENV fr24feed_directory=rpi_binaries
+ENV fr24feed_version=1.0.24-7
+ENV fr24feed_archive_suffix=armhf
+
+ARG TARGETARCH
+FROM base-$TARGETARCH
LABEL maintainer="Egor Tensin <Egor.Tensin@gmail.com>"
+ENV fr24feed_archive_name="fr24feed_${fr24feed_version}_${fr24feed_archive_suffix}.tgz"
+
# Don't prompt:
ENV DEBIAN_FRONTEND=noninteractive
@@ -13,19 +36,13 @@ RUN runtime_deps='ca-certificates procps' && \
apt-get update -yq && \
apt-get install -yq --no-install-recommends $runtime_deps
-# Variables:
-ARG FR24FEED_VERSION=1.0.24-7
-ARG FR24FEED_ARCH=armhf
-
-# Download fr24feed:
WORKDIR /tmp
-ADD ["https://repo-feed.flightradar24.com/rpi_binaries/fr24feed_${FR24FEED_VERSION}_${FR24FEED_ARCH}.tgz", "./"]
-RUN tar xzf fr24feed_${FR24FEED_VERSION}_${FR24FEED_ARCH}.tgz
+ADD ["https://repo-feed.flightradar24.com/$fr24feed_directory/$fr24feed_archive_name", "./"]
+RUN tar xzf "$fr24feed_archive_name"
-# fr24feed config:
COPY ["fr24feed.ini", "/etc/"]
EXPOSE 8754
-WORKDIR fr24feed_${FR24FEED_ARCH}
+WORKDIR "fr24feed_${fr24feed_archive_suffix}"
CMD ["./fr24feed"]