From 86a08d15f3093326707229293ec216ec750105a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Gy=C3=B6ngy=C3=B6si?= Date: Sat, 11 Apr 2026 09:30:19 +0200 Subject: [PATCH 1/6] Publish multi-arch images automatically with docker/github-builder Switch from manual Docker image building and Docker Hub pushing to an automated workflow that also provides ARM64 builds on each release. It requires releases being created from now on at https://github.com/wiktorn/overpass-api/releases/new. It also uses the DOCKERHUB_TOKEN repository secret and DOCKERHUB_USERNAME repository variable. Both should be set manually first. Detailed changes: - Rename Dockerfile.template to Dockerfile to make it usable for the GitHub Action - ARG OVERPASS_VERSION instead of {version} Python field formatting - Remove curly bracket Python format field escaping from ENV declarations - Create docker-publish.yml which uses the new docker/github-builder GitHub action that makes configuring builds fairly simple --- .github/workflows/docker-publish.yml | 27 +++++++++++++++++++++++++++ Dockerfile.template => Dockerfile | 9 +++++---- update.py | 4 ++-- 3 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/docker-publish.yml rename Dockerfile.template => Dockerfile (90%) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..7b1fa5c --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,27 @@ +name: Publish multi-arch Docker image + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + build: + uses: docker/github-builder/.github/workflows/build.yml@v1 + permissions: + contents: read + id-token: write + with: + output: image + push: true + platforms: linux/amd64,linux/arm64 + build-args: OVERPASS_VERSION=${{ github.event.release.tag_name }} + meta-images: ${{ vars.DOCKERHUB_USERNAME }}/overpass-api + meta-tags: type=semver,pattern={{version}} + secrets: + registry-auths: | + - registry: docker.io + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/Dockerfile.template b/Dockerfile similarity index 90% rename from Dockerfile.template rename to Dockerfile index 6f52353..8508e94 100644 --- a/Dockerfile.template +++ b/Dockerfile @@ -26,7 +26,8 @@ RUN apt-get update \ zlib1g \ zlib1g-dev -ADD http://dev.overpass-api.de/releases/osm-3s_v{version}.tar.gz /app/src.tar.gz +ARG OVERPASS_VERSION +ADD http://dev.overpass-api.de/releases/osm-3s_v${OVERPASS_VERSION}.tar.gz /app/src.tar.gz RUN mkdir -p /app/src \ && cd /app/src \ @@ -91,9 +92,9 @@ COPY docker-entrypoint.sh docker-healthcheck.sh /app/ RUN chmod a+rx /app/docker-entrypoint.sh /app/bin/update_overpass.sh /app/bin/rules_loop.sh /app/bin/dispatcher_start.sh \ /app/bin/oauth_cookie_client.py /app/bin/start_fcgiwarp.sh -ENV OVERPASS_RULES_LOAD=${{OVERPASS_RULES_LOAD:-1}} -ENV OVERPASS_USE_AREAS=${{OVERPASS_USE_AREAS:-true}} -ENV OVERPASS_ALLOW_DUPLICATE_QUERIES=${{OVERPASS_ALLOW_DUPLICATE_QUERIES:-no}} +ENV OVERPASS_RULES_LOAD=${OVERPASS_RULES_LOAD:-1} +ENV OVERPASS_USE_AREAS=${OVERPASS_USE_AREAS:-true} +ENV OVERPASS_ALLOW_DUPLICATE_QUERIES=${OVERPASS_ALLOW_DUPLICATE_QUERIES:-no} EXPOSE 80 diff --git a/update.py b/update.py index 9ac58cd..618a4e5 100644 --- a/update.py +++ b/update.py @@ -28,7 +28,7 @@ def main(): response = urllib.request.urlopen(url) data = response.read().decode(response.headers.get_content_charset()) parser.feed(data) - with open("Dockerfile.template") as f: + with open("Dockerfile") as f: template = f.read() for ver in parser.versions: if any((ver.startswith(x) for x in ('0.6', 'eta', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.7.50', '0.7.52', @@ -42,7 +42,7 @@ def main(): shutil.rmtree(ver) os.mkdir(ver) with open(pathlib.Path(ver) / "Dockerfile", "w+") as f: - f.write(template.format(version=ver)) + f.write(template.replace("${OVERPASS_VERSION}", ver)) #for i in ("etc", "bin"): # shutil.copytree(i, pathlib.Path(ver) / i) #shutil.copyfile("docker-entrypoint.sh", pathlib.Path(ver) / "docker-entrypoint.sh") From 85bfdc01b4284ff372ed11ae965e44d3513a1295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Gy=C3=B6ngy=C3=B6si?= Date: Sun, 19 Apr 2026 13:10:42 +0200 Subject: [PATCH 2/6] Add workflow_dispatch to enable manually triggering builds This resolves https://github.com/wiktorn/Overpass-API/pull/167#discussion_r3106591520. --- .github/workflows/docker-publish.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 7b1fa5c..349d902 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -3,6 +3,12 @@ name: Publish multi-arch Docker image on: release: types: [published] + workflow_dispatch: + inputs: + overpass_version: + description: 'Version number to build (e.g. 0.7.62)' + required: true + type: string permissions: contents: read @@ -17,7 +23,7 @@ jobs: output: image push: true platforms: linux/amd64,linux/arm64 - build-args: OVERPASS_VERSION=${{ github.event.release.tag_name }} + build-args: OVERPASS_VERSION=${{ github.event.release.tag_name || inputs.overpass_version }} meta-images: ${{ vars.DOCKERHUB_USERNAME }}/overpass-api meta-tags: type=semver,pattern={{version}} secrets: From adcbdf5287f0341b954ff41c117c8072b90025dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Gy=C3=B6ngy=C3=B6si?= Date: Sun, 19 Apr 2026 13:20:15 +0200 Subject: [PATCH 3/6] Enable layer caching with 'cache-mode: max' This resolves https://github.com/wiktorn/Overpass-API/pull/167#discussion_r3106595278. --- .github/workflows/docker-publish.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 349d902..f0273bb 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -24,6 +24,8 @@ jobs: push: true platforms: linux/amd64,linux/arm64 build-args: OVERPASS_VERSION=${{ github.event.release.tag_name || inputs.overpass_version }} + cache: true + cache-mode: max meta-images: ${{ vars.DOCKERHUB_USERNAME }}/overpass-api meta-tags: type=semver,pattern={{version}} secrets: From 3c699a3e89cf81dd3d5868367be2be4e88efbf27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Gy=C3=B6ngy=C3=B6si?= Date: Tue, 21 Apr 2026 18:46:12 +0200 Subject: [PATCH 4/6] update.py should print versions to build for build.sh This resolves https://github.com/wiktorn/Overpass-API/pull/167#discussion_r3106606575. --- build.sh | 26 ++++++++++++++++---------- update.py | 38 ++++++++++++++------------------------ 2 files changed, 30 insertions(+), 34 deletions(-) diff --git a/build.sh b/build.sh index d49135a..bc6c5d9 100755 --- a/build.sh +++ b/build.sh @@ -2,23 +2,29 @@ set -e +IMAGE=wiktorn/overpass-api + case "$1" in "build") - python update.py + versions=$(python update.py) - # docker build - find . -maxdepth 1 -type d -name '0.*' -exec sh -c 'docker build -t wiktorn/overpass-api:$(basename "$1") -f "$1"/Dockerfile .' sh {} \; + for version in $versions; do + docker build --build-arg "OVERPASS_VERSION=${version}" -t "${IMAGE}:${version}" . + done - # docker tag - while IFS= read -r -d '' file; do - docker tag "wiktorn/overpass-api:$(basename "$file")" wiktorn/overpass-api:latest - done < <(find . -maxdepth 1 -type d -regex '\./[0-9]\.[0-9]\.[0-9]*' -print0 | sort -nz | tail -z -n 1) + latest=$(echo "$versions" | sort -V | tail -n 1) + docker tag "${IMAGE}:${latest}" "${IMAGE}:latest" ;; + "push") - # docker push - find . -maxdepth 1 -type d -name '0.*' -exec sh -c 'docker push "wiktorn/overpass-api:$(basename "$1")"' sh {} \; - docker push wiktorn/overpass-api:latest + versions=$(python update.py) + + for version in $versions; do + docker push "${IMAGE}:${version}" + done + docker push "${IMAGE}:latest" ;; + "$1") echo "Invalid argument $1" echo "Valid arguments:" diff --git a/update.py b/update.py index 618a4e5..de4ce74 100644 --- a/update.py +++ b/update.py @@ -1,10 +1,12 @@ import html.parser -import os -import pathlib -import shutil import urllib.request url = "http://dev.overpass-api.de/releases/" +skip_prefixes = ( + '0.6', 'eta', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.7.50', '0.7.52', + '0.7.54.11', # invalid CRC in archive + '0.7.51', # no autoconf +) class VersionFinder(html.parser.HTMLParser): @@ -23,31 +25,19 @@ def handle_starttag(self, tag, attrs): self.versions.append(version) -def main(): +def versions_to_build(): parser = VersionFinder() response = urllib.request.urlopen(url) data = response.read().decode(response.headers.get_content_charset()) parser.feed(data) - with open("Dockerfile") as f: - template = f.read() - for ver in parser.versions: - if any((ver.startswith(x) for x in ('0.6', 'eta', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.7.50', '0.7.52', - '0.7.54.11', # invalid CRC in archive - '0.7.51', # no autoconf - ))) or \ - ver == '0.7': - # ignore old releases - continue - if os.path.exists(ver): - shutil.rmtree(ver) - os.mkdir(ver) - with open(pathlib.Path(ver) / "Dockerfile", "w+") as f: - f.write(template.replace("${OVERPASS_VERSION}", ver)) - #for i in ("etc", "bin"): - # shutil.copytree(i, pathlib.Path(ver) / i) - #shutil.copyfile("docker-entrypoint.sh", pathlib.Path(ver) / "docker-entrypoint.sh") - #shutil.copyfile("requirements.txt", pathlib.Path(ver) / "requirements.txt") + + return [ + version for version in parser.versions + if version != '0.7' + and not any(version.startswith(skip_prefix) for skip_prefix in skip_prefixes) + ] if __name__ == '__main__': - main() + for version_to_build in versions_to_build(): + print(version_to_build) From f6ba583761f5f06a4e4f065b5885ff0a6bda993d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Gy=C3=B6ngy=C3=B6si?= Date: Fri, 24 Apr 2026 12:31:51 +0200 Subject: [PATCH 5/6] Call update.py only once This resolves https://github.com/wiktorn/Overpass-API/pull/167#discussion_r3136056578. --- build.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/build.sh b/build.sh index bc6c5d9..5469731 100755 --- a/build.sh +++ b/build.sh @@ -3,23 +3,20 @@ set -e IMAGE=wiktorn/overpass-api +VERSIONS=$(python update.py) case "$1" in "build") - versions=$(python update.py) - - for version in $versions; do + for version in $VERSIONS; do docker build --build-arg "OVERPASS_VERSION=${version}" -t "${IMAGE}:${version}" . done - latest=$(echo "$versions" | sort -V | tail -n 1) + latest=$(echo "$VERSIONS" | sort -V | tail -n 1) docker tag "${IMAGE}:${latest}" "${IMAGE}:latest" ;; "push") - versions=$(python update.py) - - for version in $versions; do + for version in $VERSIONS; do docker push "${IMAGE}:${version}" done docker push "${IMAGE}:latest" From 6d8a5a33bb2579e2d7f16b42c03725320cf4e08e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Gy=C3=B6ngy=C3=B6si?= Date: Fri, 24 Apr 2026 16:26:31 +0200 Subject: [PATCH 6/6] Fix grammar of error log --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 5469731..7c2573e 100755 --- a/build.sh +++ b/build.sh @@ -25,8 +25,8 @@ case "$1" in "$1") echo "Invalid argument $1" echo "Valid arguments:" - echo "$0 build - to build docker images" - echo "$0 push - to push built images to docker hub" + echo "$0 build - to build Docker images" + echo "$0 push - to push built images to Docker Hub" exit 1 ;; esac