Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/build-base-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.10"
- "3.12"
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -26,5 +31,7 @@ jobs:
with:
file: Dockerfile.base
push: true
tags: quara/blez-base:3.10
tags: quara/blez-base:${{ matrix.python-version }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
build-args: |
PYTHON_VERSION=${{ matrix.python-version }}
10 changes: 7 additions & 3 deletions .github/workflows/build-blez-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version:
python-version:
- "3.10"
- "3.12"
bluez-version:
- "5.66"
- "5.85"
steps:
Expand All @@ -31,7 +34,8 @@ jobs:
uses: docker/build-push-action@v3
with:
push: true
tags: quara/blez:3.10_${{ matrix.version }}
tags: quara/blez:${{ matrix.python-version }}_${{ matrix.bluez-version }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
build-args: |
BLUEZ_VERSION=${{ matrix.version }}
PYTHON_VERSION=${{ matrix.python-version }}
BLUEZ_VERSION=${{ matrix.bluez-version }}
5 changes: 4 additions & 1 deletion .github/workflows/build-bluez.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
version:
- "3.10_5.66"
- "3.10_5.85"
- "3.12_5.66"
- "3.12_5.85"
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -27,8 +29,9 @@ jobs:
uses: docker/setup-buildx-action@v2
- name: Build
run: |
PYTHON_VERSION=$(echo "${{ matrix.version }}" | cut -d'_' -f1)
BLUEZ_VERSION=$(echo "${{ matrix.version }}" | cut -d'_' -f2)
./scripts/cp-build.sh ${{ matrix.platform }} $BLUEZ_VERSION
./scripts/cp-build.sh ${{ matrix.platform }} $PYTHON_VERSION $BLUEZ_VERSION
- name: Set artifact name
id: artifact
run: echo "name=dist-$(echo '${{ matrix.platform }}' | tr '/' '-')-${{ matrix.version }}" >> $GITHUB_OUTPUT
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/build-cp-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.10"
- "3.12"
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -26,5 +31,7 @@ jobs:
with:
file: Dockerfile.build
push: true
tags: quara/blez-build:3.10
tags: quara/blez-build:${{ matrix.python-version }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
build-args: |
PYTHON_VERSION=${{ matrix.python-version }}
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM quara/blez-base:3.10
ARG PYTHON_VERSION=3.12
FROM quara/blez-base:${PYTHON_VERSION}

COPY scripts /opt/blez-scripts

Expand Down
25 changes: 13 additions & 12 deletions Dockerfile.base
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
FROM python:3.10-slim
ARG PYTHON_VERSION=3.12
FROM python:${PYTHON_VERSION}-slim

# Install runtime dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
dbus \
libglib2.0-0 \
supervisor \
ca-certificates \
curl \
dbus \
libglib2.0-0t64 \
supervisor \
&& rm -rf \
/var/lib/apt/lists/* \
/var/cache/apt/archives \
/var/lib/apt/lists/* \
/var/cache/apt/archives \
&& groupadd bluetooth

# Create directories
RUN mkdir -p \
/etc/bluetooth \
/etc/dbus-1/system.d \
/etc/supervisor \
/etc/supervisor.d
/etc/bluetooth \
/etc/dbus-1/system.d \
/etc/supervisor \
/etc/supervisor.d
31 changes: 16 additions & 15 deletions Dockerfile.build
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
FROM python:3.10-slim
ARG PYTHON_VERSION=3.12
FROM python:${PYTHON_VERSION}-slim

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
automake \
ca-certificates \
gcc \
git \
libdbus-1-dev \
libglib2.0-dev \
libical-dev \
libreadline-dev \
libtool \
libudev-dev \
make \
udev \
automake \
ca-certificates \
gcc \
git \
libdbus-1-dev \
libglib2.0-dev \
libical-dev \
libreadline-dev \
libtool \
libudev-dev \
make \
udev \
&& rm -rf \
/var/lib/apt/lists/* \
/var/cache/apt/archives
/var/lib/apt/lists/* \
/var/cache/apt/archives
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
## Usage

### Building Docker Images

All Dockerfiles support a `PYTHON_VERSION` build arg (defaults to `3.12`).

```bash
# Build base image (Python 3.12, default)
docker build -f Dockerfile.base -t quara/blez-base:3.12 .

# Build base image (Python 3.10)
docker build -f Dockerfile.base --build-arg PYTHON_VERSION=3.10 -t quara/blez-base:3.10 .

# Build build image (Python 3.12, default)
docker build -f Dockerfile.build -t quara/blez-build:3.12 .

# Build build image (Python 3.10)
docker build -f Dockerfile.build --build-arg PYTHON_VERSION=3.10 -t quara/blez-build:3.10 .

# Build final image (Python 3.12, default)
docker build -t quara/blez:3.12 .

# Build final image (Python 3.10)
docker build --build-arg PYTHON_VERSION=3.10 -t quara/blez:3.10 .
```

### Building BlueZ

- Without docker:

```bash
Expand Down
9 changes: 5 additions & 4 deletions scripts/cp-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@

set -euo pipefail

BUILD_IMAGE="quara/blez-build:latest"

ROOT_DIR=$(dirname $( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ))

function build {
PYTHON_VERSION="$1"
BUILD_IMAGE="quara/blez-build:${PYTHON_VERSION}"
OUTPUT_DIR=$(mktemp -d)
docker run -i --platform="$PLATFORM" -v "$ROOT_DIR:/build" -v "$OUTPUT_DIR:/dist" -e OUTPUT_DIR=/dist --workdir /build "$BUILD_IMAGE" scripts/build.sh $@
docker run -i --platform="$PLATFORM" -v "$ROOT_DIR:/build" -v "$OUTPUT_DIR:/dist" -e OUTPUT_DIR=/dist --workdir /build "$BUILD_IMAGE" scripts/build.sh ${@:2}
mv "$OUTPUT_DIR" "$ROOT_DIR/dist/"
}

function main {
export PLATFORM="$1"
build ${@:2}
PYTHON_VERSION="$2"
build "$PYTHON_VERSION" ${@:3}
unset PLATFORM
}

Expand Down