diff --git a/README.md b/README.md index 238c64c..a20e334 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,8 @@ Alternatively, if you have already cloned the repo, you can fetch just the prebu > **Warning:** Docker has had reports intermittent issues with serial event subscriptions. The native method above is more reliable. +Local Docker builds are architecture-native by default. On Apple Silicon Macs and ARM64 Linux hosts such as Raspberry Pi, `docker compose build` / `docker compose up --build` will produce an ARM64 image unless you override the platform. + Edit `docker-compose.yaml` to set a serial device for passthrough, or uncomment your transport (serial or TCP). Then: ```bash @@ -148,6 +150,15 @@ docker compose pull docker compose up -d ``` +Published Docker tags are intended to be multi-arch (`linux/amd64` and `linux/arm64`). If you are building and publishing manually, use Docker Buildx: + +```bash +docker buildx build \ + --platform linux/amd64,linux/arm64 \ + -t jkingsman/remoteterm-meshcore:latest \ + --push . +``` + The container runs as root by default for maximum serial passthrough compatibility across host setups. On Linux, if you switch between native and Docker runs, `./data` can end up root-owned. If you do not need that serial compatibility behavior, you can enable the optional `user: "${UID:-1000}:${GID:-1000}"` line in `docker-compose.yaml` to keep ownership aligned with your host user. To stop: diff --git a/scripts/publish.sh b/scripts/publish.sh index 44fdb00..f994241 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -12,6 +12,8 @@ cd "$SCRIPT_DIR" RELEASE_WORK_DIR="" RELEASE_BUNDLE_DIR_NAME="Remote-Terminal-for-MeshCore" +DOCKER_IMAGE="jkingsman/remoteterm-meshcore" +DOCKER_PLATFORMS="linux/amd64,linux/arm64" cleanup_release_build_artifacts() { if [ -d "$SCRIPT_DIR/frontend/prebuilt" ]; then @@ -24,6 +26,28 @@ cleanup_release_build_artifacts() { trap cleanup_release_build_artifacts EXIT +ensure_buildx_builder() { + if ! docker buildx version >/dev/null 2>&1; then + echo -e "${RED}Error: docker buildx is required for multi-arch Docker builds.${NC}" + exit 1 + fi + + local current_builder + current_builder="$(docker buildx inspect --format '{{ .Name }}' 2>/dev/null || true)" + + if [ -n "$current_builder" ]; then + docker buildx inspect --bootstrap >/dev/null + return + fi + + if docker buildx inspect remoteterm-multiarch >/dev/null 2>&1; then + docker buildx use remoteterm-multiarch >/dev/null + else + docker buildx create --name remoteterm-multiarch --use >/dev/null + fi + docker buildx inspect --bootstrap >/dev/null +} + echo -e "${YELLOW}=== RemoteTerm for MeshCore Publish Script ===${NC}" echo @@ -199,21 +223,18 @@ rm -f "$SCRIPT_DIR/$RELEASE_ASSET" echo -e "${GREEN}Packaged release artifact created: $RELEASE_ASSET${NC}" echo -# Build docker image -echo -e "${YELLOW}Building Docker image...${NC}" -docker build --build-arg COMMIT_HASH=$GIT_HASH \ - -t jkingsman/remoteterm-meshcore:latest \ - -t jkingsman/remoteterm-meshcore:$VERSION \ - -t jkingsman/remoteterm-meshcore:$GIT_HASH . -echo -e "${GREEN}Docker build complete!${NC}" -echo - -# Push docker images -echo -e "${YELLOW}Pushing Docker images...${NC}" -docker push jkingsman/remoteterm-meshcore:latest -docker push jkingsman/remoteterm-meshcore:$VERSION -docker push jkingsman/remoteterm-meshcore:$GIT_HASH -echo -e "${GREEN}Docker push complete!${NC}" +# Build and push multi-arch docker image +echo -e "${YELLOW}Building and pushing multi-arch Docker image...${NC}" +ensure_buildx_builder +docker buildx build \ + --platform "$DOCKER_PLATFORMS" \ + --build-arg COMMIT_HASH="$GIT_HASH" \ + -t "$DOCKER_IMAGE:latest" \ + -t "$DOCKER_IMAGE:$VERSION" \ + -t "$DOCKER_IMAGE:$GIT_HASH" \ + --push \ + . +echo -e "${GREEN}Multi-arch Docker build + push complete!${NC}" echo # Create GitHub release using the changelog notes for this version. @@ -254,9 +275,12 @@ echo -e "${GREEN}=== Publish complete! ===${NC}" echo -e "Version: ${YELLOW}$VERSION${NC}" echo -e "Git hash: ${YELLOW}$GIT_HASH${NC}" echo -e "Docker tags pushed:" -echo -e " - jkingsman/remoteterm-meshcore:latest" -echo -e " - jkingsman/remoteterm-meshcore:$VERSION" -echo -e " - jkingsman/remoteterm-meshcore:$GIT_HASH" +echo -e " - $DOCKER_IMAGE:latest" +echo -e " - $DOCKER_IMAGE:$VERSION" +echo -e " - $DOCKER_IMAGE:$GIT_HASH" +echo -e "Platforms:" +echo -e " - linux/amd64" +echo -e " - linux/arm64" echo -e "GitHub release:" echo -e " - $VERSION" echo -e "Release artifact:"