Skip to content

Commit

Permalink
👷 Publish to DockerHub
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
AndreMiras committed Jan 12, 2025
1 parent f3c5bb3 commit 1a591de
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 100 deletions.
50 changes: 0 additions & 50 deletions .github/workflows/android.yml

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Docker

on:
push:
pull_request:
workflow_dispatch:

env:
IMAGE_NAME: kivy/buildozer
# TODO: debugging
# SHOULD_PUBLISH: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}
SHOULD_PUBLISH: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/feature/docker_ci' || startsWith(github.ref, 'refs/tags/')) }}

jobs:
build:
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
if: ${{ env.SHOULD_PUBLISH == 'true' }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push Multi-platform Image
uses: docker/build-push-action@v6
with:
push: ${{ env.SHOULD_PUBLISH == 'true' }}
tags: ${{ env.IMAGE_NAME }}:latest
platforms: linux/amd64,linux/arm64
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:latest
cache-to: ${{ env.SHOULD_PUBLISH == 'true' && format('type=registry,ref={0}:latest,mode=max', env.IMAGE_NAME) || '' }}
- name: Local Build for Testing
with:
# Load image into local Docker daemon
load: true
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:latest
tags: ${{ env.IMAGE_NAME }}:latest
# Run the locally built image to test it
- name: Docker run
run: docker run ${{ env.IMAGE_NAME }} --version

update-readme:
runs-on: ubuntu-24.04
needs: build
steps:
- uses: actions/checkout@v4
- uses: peter-evans/dockerhub-description@v4
if: ${{ env.SHOULD_PUBLISH == 'true' }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ env.IMAGE_NAME }}
readme-filepath: README.md
33 changes: 0 additions & 33 deletions .github/workflows/ios.yml

This file was deleted.

22 changes: 13 additions & 9 deletions .github/workflows/test_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,23 @@ jobs:
run: tox
- name: Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github-actions
COVERALLS_FLAG_NAME: python-${{ matrix.python }}-${{ matrix.os }}
COVERALLS_PARALLEL: true
run: coveralls

Docker:
Coveralls:
needs: Tests
runs-on: ubuntu-latest
container: python:3-slim
steps:
- uses: actions/checkout@v4
- name: Docker build
run: docker build --tag=kivy/buildozer .
- name: Docker run
run: docker run kivy/buildozer --version
- name: Finished
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip install coveralls
coveralls --finish
Documentation:
runs-on: ubuntu-latest
Expand All @@ -55,4 +60,3 @@ jobs:
run: sphinx-build -b linkcheck docs/source docs/build
- name: Generate documentation
run: sphinx-build docs/source docs/build

10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ build dependencies. For more information, see
[![Android](https://github.com/kivy/buildozer/workflows/Android/badge.svg)](https://github.com/kivy/buildozer/actions?query=workflow%3AAndroid)
[![iOS](https://github.com/kivy/buildozer/workflows/iOS/badge.svg)](https://github.com/kivy/buildozer/actions?query=workflow%3AiOS)
[![Coverage Status](https://coveralls.io/repos/github/kivy/buildozer/badge.svg)](https://coveralls.io/github/kivy/buildozer)
[![TODO](https://github.com/kivy/buildozer/workflows/Docker/badge.svg)](https://github.com/kivy/buildozer/actions?query=workflow%3ATests)


## Installation
Expand Down Expand Up @@ -68,7 +69,7 @@ docker build --tag=kivy/buildozer .
For macOS, build with:

```bash
docker buildx build --platform=linux/amd64 -t kivy/buildozer .
docker buildx build --platform=linux/amd64 --tag=kivy/buildozer .
```

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

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

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

> [!WARNING]
> This GitHub action may use an obsolete version of Buildozer; use with caution.
## Usage

```yml
Expand Down

0 comments on commit 1a591de

Please sign in to comment.