Skip to content

Commit

Permalink
multi-arch builds
Browse files Browse the repository at this point in the history
  • Loading branch information
missinglink committed Feb 28, 2025
1 parent 9382835 commit b1a7040
Show file tree
Hide file tree
Showing 17 changed files with 131 additions and 69 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Continuous Integration
on: push
on:
push:
branches-ignore:
- runtime
jobs:
build-docker-images:
runs-on: ubuntu-latest
Expand Down
30 changes: 24 additions & 6 deletions .github/workflows/runtime_alpine_3_10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,31 @@ jobs:
name: 'build & push: runtime_alpine_3_10'
runs-on: ubuntu-latest
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Check out the repo
uses: actions/checkout@v2
- name: runtime_alpine_3_10
uses: docker/build-push-action@v1
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: pelias/spatial
dockerfile: runtime/runtime.alpine.3.10.Dockerfile
tags: runtime_alpine_3_10
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build Docker Images
env:
TAG: runtime_alpine_3_10
FILE: runtime/runtime.debian.buster.Dockerfile
run: |
docker buildx create --use --bootstrap --platform='linux/amd64,linux/arm64' --name 'multi-platform-builder'
docker buildx build --platform 'linux/amd64' -f $FILE -t pelias/spatial:$TAG .
docker buildx build --platform 'linux/arm64' -f $FILE -t pelias/spatial:$TAG .
docker buildx build --platform 'linux/arm64,linux/amd64' -f $FILE -t pelias/spatial:$TAG --push .
30 changes: 24 additions & 6 deletions .github/workflows/runtime_debian_buster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,31 @@ jobs:
name: 'build & push: runtime_debian_buster'
runs-on: ubuntu-latest
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Check out the repo
uses: actions/checkout@v2
- name: runtime_debian_buster
uses: docker/build-push-action@v1
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: pelias/spatial
dockerfile: runtime/runtime.debian.buster.Dockerfile
tags: runtime_debian_buster
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build Docker Images
env:
TAG: runtime_debian_buster
FILE: runtime/runtime.debian.buster.Dockerfile
run: |
docker buildx create --use --bootstrap --platform='linux/amd64,linux/arm64' --name 'multi-platform-builder'
docker buildx build --platform 'linux/amd64' -f $FILE -t pelias/spatial:$TAG .
docker buildx build --platform 'linux/arm64' -f $FILE -t pelias/spatial:$TAG .
docker buildx build --platform 'linux/arm64,linux/amd64' -f $FILE -t pelias/spatial:$TAG --push .
30 changes: 24 additions & 6 deletions .github/workflows/runtime_ubuntu_bionic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,31 @@ jobs:
name: 'build & push: runtime_ubuntu_bionic'
runs-on: ubuntu-latest
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Check out the repo
uses: actions/checkout@v2
- name: runtime_ubuntu_bionic
uses: docker/build-push-action@v1
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: pelias/spatial
dockerfile: runtime/runtime.ubuntu.bionic.Dockerfile
tags: runtime_ubuntu_bionic
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build Docker Images
env:
TAG: runtime_ubuntu_bionic
FILE: runtime/runtime.ubuntu.bionic.Dockerfile
run: |
docker buildx create --use --bootstrap --platform='linux/amd64,linux/arm64' --name 'multi-platform-builder'
docker buildx build --platform 'linux/amd64' -f $FILE -t pelias/spatial:$TAG .
docker buildx build --platform 'linux/arm64' -f $FILE -t pelias/spatial:$TAG .
docker buildx build --platform 'linux/arm64,linux/amd64' -f $FILE -t pelias/spatial:$TAG --push .
30 changes: 24 additions & 6 deletions .github/workflows/runtime_ubuntu_focal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,31 @@ jobs:
name: 'build & push: runtime_ubuntu_focal'
runs-on: ubuntu-latest
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Check out the repo
uses: actions/checkout@v2
- name: runtime_ubuntu_focal
uses: docker/build-push-action@v1
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: pelias/spatial
dockerfile: runtime/runtime.ubuntu.focal.Dockerfile
tags: runtime_ubuntu_focal
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build Docker Images
env:
TAG: runtime_ubuntu_focal
FILE: runtime/runtime.ubuntu.focal.Dockerfile
run: |
docker buildx create --use --bootstrap --platform='linux/amd64,linux/arm64' --name 'multi-platform-builder'
docker buildx build --platform 'linux/amd64' -f $FILE -t pelias/spatial:$TAG .
docker buildx build --platform 'linux/arm64' -f $FILE -t pelias/spatial:$TAG .
docker buildx build --platform 'linux/arm64,linux/amd64' -f $FILE -t pelias/spatial:$TAG --push .
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
# 4. Produce a minimally sized image for distribution

# 1. ------------------------------------------------
FROM pelias/spatial:runtime_ubuntu_bionic as runtime
FROM pelias/spatial:runtime_ubuntu_bionic AS runtime

# 2. ------------------------------------------------
FROM pelias/baseimage as better_sqlite3
FROM pelias/baseimage AS better_sqlite3

# we require clang++ for compiling better-sqlite3
# this adds ~400MB to the image, so we build in a
# separate image and only copy the files we need.
RUN apt-get update -y
RUN apt-get install -y clang python3 make
RUN apt-get install -y clang python3 build-essential

# copy runtime
COPY --from=runtime /opt/spatial /opt/spatial
Expand All @@ -27,7 +27,7 @@ WORKDIR /code
RUN bin/compile_better_sqlite3

# 3. ------------------------------------------------
FROM pelias/baseimage as testing
FROM pelias/baseimage AS testing

# copy runtime
COPY --from=runtime /opt/spatial /opt/spatial
Expand Down
4 changes: 2 additions & 2 deletions runtime/install/_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ function gaia_download(){
function gaia_clone(){
REPO="$1"
rm -rf "${REPO}" "${REPO}.fossil"*
USER='me' fossil clone https://www.gaia-gis.it/fossil/$REPO $REPO.fossil
USER='me' fossil clone https://www.gaia-gis.it/fossil/$REPO $REPO.fossil | wc -l
mkdir -p "${REPO}"
cd "${REPO}"
fossil open "../${REPO}.fossil"
fossil open "../${REPO}.fossil" | wc -l
cd -
rm -rf "${REPO}.fossil"*
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/install/geos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ cd geos

# compile and install in runtime directory
make -j8
make install-strip
make install

# clean up
rm -rf /tmp/geos
2 changes: 1 addition & 1 deletion runtime/install/libxml2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cd /tmp
rm -rf libxml2 && mkdir -p libxml2

# download release and decompress it
curl -L 'ftp://xmlsoft.org/libxml2/libxml2-2.9.10.tar.gz' \
curl -L 'ftp://xmlsoft.org/libxml2/libxml2-2.9.12.tar.gz' \
| tar -xz --strip-components=1 -C libxml2

# working directory
Expand Down
2 changes: 1 addition & 1 deletion runtime/install/proj7.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cd /tmp
rm -rf proj7 && mkdir -p proj7

# download release and decompress it
curl -L 'https://download.osgeo.org/proj/proj-7.0.1.tar.gz' \
curl -L 'https://download.osgeo.org/proj/proj-7.2.1.tar.gz' \
| tar -xz --strip-components=1 -C proj7

# working directory
Expand Down
3 changes: 3 additions & 0 deletions runtime/install/readosm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export CPPFLAGS="-I${RUNTIME}/include"
export LDFLAGS="-L${RUNTIME}/lib"
export LIBS="-ldl"

# generate config.guess
autoreconf -fi

# configure build
./configure \
--prefix="${RUNTIME}" \
Expand Down
27 changes: 5 additions & 22 deletions runtime/install/spatialite-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,6 @@ export CPPFLAGS="-I${RUNTIME}/include"
export LDFLAGS="-L${RUNTIME}/lib"
export LDFLAGS="${LDFLAGS} -Wl,-rpath,${RUNTIME}/lib" # set 'rpath'
export PKG_CONFIG_PATH="${RUNTIME}/lib/pkgconfig"
export LIBS='-ldl ' # note: requires trailing space!

# link spatialite
export LIBSPATIALITE_CFLAGS="-I${RUNTIME}/include"
export LIBSPATIALITE_LIBS='-lspatialite'

# link readosm
export LIBREADOSM_CFLAGS="-I${RUNTIME}/include"
export LIBREADOSM_LIBS="-L${RUNTIME}/lib -lreadosm"

# link rttopo
export RTTOPO_CFLAGS="-I${RUNTIME}/include"
export RTTOPO_LIBS='-lrttopo'

# link libxml2
export LIBXML2_CFLAGS="-I${RUNTIME}/include/libxml2"
export LIBXML2_LIBS="-L${RUNTIME}/lib -lxml2"

# fix for expat install!?
if [ -x "$(command -v gsed)" ]; then
Expand All @@ -45,19 +28,19 @@ else
sed -i 's:LIBS="-lexpat $LIBS":LIBS="-L/opt/spatial/lib -lexpat":g' configure
fi

# generate config.guess
autoreconf -fi

# configure build
./configure \
--prefix="${RUNTIME}" \
--disable-dependency-tracking \
--enable-rttopo \
--enable-libxml2 \
--disable-freexl \
--with-geosconfig="${RUNTIME}/bin/geos-config" \
--disable-readosm \
--enable-static=no

# compile and install in runtime directory
make -j8
make install-strip
make install

## test binary correctly linked in empty env
env -i "${RUNTIME}/bin/spatialite" :memory: 'SELECT spatialite_version()'
Expand Down
10 changes: 6 additions & 4 deletions runtime/install/spatialite5.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ cd 'libspatialite'
export CPPFLAGS="-I${RUNTIME}/include"
export LDFLAGS="-L${RUNTIME}/lib"
export LDFLAGS="${LDFLAGS} -Wl,-rpath,${RUNTIME}/lib" # set 'rpath'
export LIBS='-ldl'
export PKG_CONFIG_PATH="${RUNTIME}/lib/pkgconfig"

# link libxml2
export LIBXML2_CFLAGS="-I${RUNTIME}/include/libxml2"
export LIBXML2_LIBS="-L${RUNTIME}/lib -lxml2"
# generate config.guess
autoreconf -fi

# configure build
./configure \
Expand All @@ -35,6 +34,9 @@ export LIBXML2_LIBS="-L${RUNTIME}/lib -lxml2"
--enable-rttopo=yes \
--enable-proj=yes \
--enable-geos=yes \
--disable-geos390 \
--disable-geos3100 \
--disable-geos3110 \
--enable-gcp=yes \
--enable-libxml2=yes \
--disable-freexl \
Expand Down
7 changes: 3 additions & 4 deletions runtime/runtime.alpine.3.10.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
FROM alpine:3.10 as build
FROM alpine:3.10 AS build

# apk dependencies
RUN echo "@edge http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories
RUN apk update && \
apk --no-cache --update upgrade musl && \
apk add --upgrade --force-overwrite apk-tools@edge && \
apk add --update --force-overwrite autoconf automake gcc g++ libtool make musl-dev@edge && \
apk add --upgrade --force-overwrite apk-tools && \
apk add --update --force-overwrite autoconf automake gcc g++ libtool make musl-dev cmake && \
apk add --update --force-overwrite curl-dev && \
apk add --update --force-overwrite bash curl file unzip && \
apk add --update --force-overwrite fossil git && \
Expand Down
4 changes: 2 additions & 2 deletions runtime/runtime.debian.buster.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM debian:buster as build
FROM debian:buster AS build
ENV DEBIAN_FRONTEND=noninteractive

# apt dependencies
RUN apt-get update -y && \
apt-get install -y build-essential autoconf libtool pkg-config && \
apt-get install -y build-essential autoconf libtool pkg-config cmake && \
apt-get install -y libcurl4-gnutls-dev && \
apt-get install -y curl unzip && \
apt-get install -y fossil git-core && \
Expand Down
2 changes: 1 addition & 1 deletion runtime/runtime.ubuntu.bionic.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:bionic as build
FROM ubuntu:bionic AS build
ENV DEBIAN_FRONTEND=noninteractive

# apt dependencies
Expand Down
4 changes: 2 additions & 2 deletions runtime/runtime.ubuntu.focal.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM ubuntu:focal as build
FROM ubuntu:focal AS build
ENV DEBIAN_FRONTEND=noninteractive

# apt dependencies
RUN apt-get update -y && \
apt-get install -y build-essential autoconf libtool pkg-config && \
apt-get install -y build-essential autoconf libtool pkg-config cmake && \
apt-get install -y libcurl4-gnutls-dev && \
apt-get install -y curl unzip && \
apt-get install -y fossil git-core && \
Expand Down

0 comments on commit b1a7040

Please sign in to comment.