Skip to content

Commit 86a08d1

Browse files
committed
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
1 parent 3af1629 commit 86a08d1

3 files changed

Lines changed: 34 additions & 6 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish multi-arch Docker image
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
build:
12+
uses: docker/github-builder/.github/workflows/build.yml@v1
13+
permissions:
14+
contents: read
15+
id-token: write
16+
with:
17+
output: image
18+
push: true
19+
platforms: linux/amd64,linux/arm64
20+
build-args: OVERPASS_VERSION=${{ github.event.release.tag_name }}
21+
meta-images: ${{ vars.DOCKERHUB_USERNAME }}/overpass-api
22+
meta-tags: type=semver,pattern={{version}}
23+
secrets:
24+
registry-auths: |
25+
- registry: docker.io
26+
username: ${{ vars.DOCKERHUB_USERNAME }}
27+
password: ${{ secrets.DOCKERHUB_TOKEN }}
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ RUN apt-get update \
2626
zlib1g \
2727
zlib1g-dev
2828

29-
ADD http://dev.overpass-api.de/releases/osm-3s_v{version}.tar.gz /app/src.tar.gz
29+
ARG OVERPASS_VERSION
30+
ADD http://dev.overpass-api.de/releases/osm-3s_v${OVERPASS_VERSION}.tar.gz /app/src.tar.gz
3031

3132
RUN mkdir -p /app/src \
3233
&& cd /app/src \
@@ -91,9 +92,9 @@ COPY docker-entrypoint.sh docker-healthcheck.sh /app/
9192
RUN chmod a+rx /app/docker-entrypoint.sh /app/bin/update_overpass.sh /app/bin/rules_loop.sh /app/bin/dispatcher_start.sh \
9293
/app/bin/oauth_cookie_client.py /app/bin/start_fcgiwarp.sh
9394

94-
ENV OVERPASS_RULES_LOAD=${{OVERPASS_RULES_LOAD:-1}}
95-
ENV OVERPASS_USE_AREAS=${{OVERPASS_USE_AREAS:-true}}
96-
ENV OVERPASS_ALLOW_DUPLICATE_QUERIES=${{OVERPASS_ALLOW_DUPLICATE_QUERIES:-no}}
95+
ENV OVERPASS_RULES_LOAD=${OVERPASS_RULES_LOAD:-1}
96+
ENV OVERPASS_USE_AREAS=${OVERPASS_USE_AREAS:-true}
97+
ENV OVERPASS_ALLOW_DUPLICATE_QUERIES=${OVERPASS_ALLOW_DUPLICATE_QUERIES:-no}
9798

9899
EXPOSE 80
99100

update.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def main():
2828
response = urllib.request.urlopen(url)
2929
data = response.read().decode(response.headers.get_content_charset())
3030
parser.feed(data)
31-
with open("Dockerfile.template") as f:
31+
with open("Dockerfile") as f:
3232
template = f.read()
3333
for ver in parser.versions:
3434
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():
4242
shutil.rmtree(ver)
4343
os.mkdir(ver)
4444
with open(pathlib.Path(ver) / "Dockerfile", "w+") as f:
45-
f.write(template.format(version=ver))
45+
f.write(template.replace("${OVERPASS_VERSION}", ver))
4646
#for i in ("etc", "bin"):
4747
# shutil.copytree(i, pathlib.Path(ver) / i)
4848
#shutil.copyfile("docker-entrypoint.sh", pathlib.Path(ver) / "docker-entrypoint.sh")

0 commit comments

Comments
 (0)