Update Dockerfile for Umbrel + add multi-arch CI build

Dockerfile changes:
- Use COPY instead of git clone (build from local source)
- Add entrypoint.sh for auto-configuration from env vars
- EXPOSE 6969 and configurable via PYBLOCK_PORT env var
- Create config directory as volume mount point
- ENTRYPOINT replaces CMD for pre-launch setup

New .github/workflows/docker-build.yml:
- Multi-arch build: linux/amd64 + linux/arm64 (Raspberry Pi)
- Triggers on version tags (v*.*.*)
- Pushes to Docker Hub as curly60e/pyblock:version and :latest
- Uses QEMU + Buildx for cross-compilation
- GitHub Actions cache for faster builds

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
GaltRanch 2026-04-01 16:33:03 -03:00
parent 667d5b6ae0
commit 6fad893db8
2 changed files with 63 additions and 7 deletions

44
.github/workflows/docker-build.yml vendored Normal file
View file

@ -0,0 +1,44 @@
name: Build Multi-Arch Docker Image
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up QEMU for multi-arch
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Build and push multi-arch image
uses: docker/build-push-action@v5
with:
context: .
file: ./dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
curly60e/pyblock:${{ steps.version.outputs.VERSION }}
curly60e/pyblock:latest
cache-from: type=gha
cache-to: type=gha,mode=max

View file

@ -1,8 +1,9 @@
FROM ubuntu:24.04@sha256:b59d21599a2b151e7f6a8d7b6f0e864fbb4ce8b0c9cf09be2e67f4d6e3b942a4
FROM ubuntu:24.04
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYBLOCK_PORT=6969
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
@ -25,17 +26,28 @@ RUN git clone --branch 1.7.7 --depth 1 https://github.com/tsl0922/ttyd.git \
RUN python3 -m venv /app/venv
ENV PATH="/app/venv/bin:$PATH"
# Copy project files
COPY requirements.txt /app/pyblock/requirements.txt
RUN pip install --no-cache-dir --upgrade pip \
&& git clone --depth 1 https://github.com/curly60e/pyblock.git \
&& cd pyblock \
&& pip install --no-cache-dir -r requirements.txt
&& pip install --no-cache-dir -r /app/pyblock/requirements.txt
COPY . /app/pyblock/
# Entrypoint for auto-configuration
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
# Create config volume mount point
RUN mkdir -p /app/pyblock/pybitblock/config
RUN useradd -m -s /bin/bash pyblock \
&& chown -R pyblock:pyblock /app
USER pyblock
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost:6969/ || exit 1
EXPOSE 6969
CMD ["ttyd", "-W", "-p", "6969", "-c", "Running:PyBLOCK", "python3", "pyblock/pybitblock/PyBlock.py"]
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost:${PYBLOCK_PORT:-6969}/ || exit 1
ENTRYPOINT ["/app/entrypoint.sh"]