Skip to content

Commit 193d70c

Browse files
committed
👷 Publish to DockerHub
- multi-platform build using buildx - push to DockerHub and update DockerHub README on push to main or tagging - use the Docker Hub registry for caching image layers to speed up builds
1 parent f3c5bb3 commit 193d70c

File tree

2 files changed

+56
-8
lines changed

2 files changed

+56
-8
lines changed

.github/workflows/docker.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
env:
9+
IMAGE_NAME: kivy/buildozer
10+
SHOULD_PUBLISH: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-24.04
15+
timeout-minutes: 60
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: docker/setup-buildx-action@v3
19+
- uses: docker/login-action@v3
20+
if: ${{ env.SHOULD_PUBLISH == 'true' }}
21+
with:
22+
username: ${{ secrets.DOCKERHUB_USERNAME }}
23+
password: ${{ secrets.DOCKERHUB_TOKEN }}
24+
- name: Build and Push Multi-platform Image
25+
uses: docker/build-push-action@v6
26+
with:
27+
push: ${{ env.SHOULD_PUBLISH == 'true' }}
28+
tags: ${{ env.IMAGE_NAME }}:latest
29+
platforms: linux/amd64,linux/arm64
30+
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:latest
31+
cache-to: ${{ env.SHOULD_PUBLISH == 'true' && format('type=registry,ref={0}:latest,mode=max', env.IMAGE_NAME) || '' }}
32+
- name: Local Build for Testing
33+
uses: docker/build-push-action@v6
34+
with:
35+
# Load image into local Docker daemon
36+
load: true
37+
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:latest
38+
tags: ${{ env.IMAGE_NAME }}:latest
39+
# Run the locally built image to test it
40+
- name: Docker run
41+
run: docker run ${{ env.IMAGE_NAME }} --version
42+
43+
update-readme:
44+
runs-on: ubuntu-24.04
45+
needs: build
46+
steps:
47+
- uses: actions/checkout@v4
48+
- uses: peter-evans/dockerhub-description@v4
49+
if: ${{ env.SHOULD_PUBLISH == 'true' }}
50+
with:
51+
username: ${{ secrets.DOCKERHUB_USERNAME }}
52+
password: ${{ secrets.DOCKERHUB_TOKEN }}
53+
repository: ${{ env.IMAGE_NAME }}
54+
readme-filepath: README.md

README.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ build dependencies. For more information, see
3535
[![Android](https://github.com/kivy/buildozer/workflows/Android/badge.svg)](https://github.com/kivy/buildozer/actions?query=workflow%3AAndroid)
3636
[![iOS](https://github.com/kivy/buildozer/workflows/iOS/badge.svg)](https://github.com/kivy/buildozer/actions?query=workflow%3AiOS)
3737
[![Coverage Status](https://coveralls.io/repos/github/kivy/buildozer/badge.svg)](https://coveralls.io/github/kivy/buildozer)
38+
[![Docker](https://github.com/kivy/buildozer/actions/workflows/docker.yml/badge.svg)](https://github.com/kivy/buildozer/actions/workflows/docker.yml)
3839

3940

4041
## Installation
@@ -68,7 +69,7 @@ docker build --tag=kivy/buildozer .
6869
For macOS, build with:
6970

7071
```bash
71-
docker buildx build --platform=linux/amd64 -t kivy/buildozer .
72+
docker buildx build --platform=linux/amd64 --tag=kivy/buildozer .
7273
```
7374

7475
- Run with:
@@ -77,10 +78,6 @@ docker buildx build --platform=linux/amd64 -t kivy/buildozer .
7778
docker run --volume "$(pwd)":/home/user/hostcwd kivy/buildozer --version
7879
```
7980

80-
> [!WARNING]
81-
> [DockerHub](https://hub.docker.com/) contains an obsolete Docker image for
82-
> Buildozer. It is deprecated. Build your own.
83-
8481
### Example Build with Caching
8582
- Build and keep downloaded SDK and NDK in `~/.buildozer` directory:
8683

@@ -95,9 +92,6 @@ Use [ArtemSBulgakov/buildozer-action@v1](https://github.com/ArtemSBulgakov/build
9592
to build your packages automatically on push or pull request.
9693
See [full workflow example](https://github.com/ArtemSBulgakov/buildozer-action#full-workflow).
9794

98-
> [!WARNING]
99-
> This GitHub action may use an obsolete version of Buildozer; use with caution.
100-
10195
## Usage
10296

10397
```yml

0 commit comments

Comments
 (0)