Skip to content

Commit

Permalink
test armhf builds
Browse files Browse the repository at this point in the history
  • Loading branch information
eltorio committed Oct 16, 2024
1 parent 88c5318 commit c52cd17
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 10 deletions.
48 changes: 44 additions & 4 deletions .github/workflows/multiarch-docker-hub.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2024 SCTG Development - Ronan LE MEILLAT
# SPDX-License-Identifier: AGPL-3.0-or-later

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third party and are governed by
# separate terms of service, privacy policy, and support.
Expand Down Expand Up @@ -36,6 +39,8 @@ jobs:
attestations: write
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
env:
DOCKER_ARMHF_EXPERIMENTAL: enabled # Set to 'enabled' to enable armhf build
steps:
- name: Check out the repo
uses: actions/checkout@v4
Expand All @@ -46,7 +51,7 @@ jobs:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: 'arm64'
platforms: 'linux/arm64,linux/armhf,linux/amd64'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
Expand Down Expand Up @@ -82,7 +87,7 @@ jobs:
with:
context: .
file: ./Dockerfile-integration
platforms: linux/arm64, linux/amd64
platforms: linux/arm64, linux/amd64, linux/armhf
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
Expand Down Expand Up @@ -123,6 +128,24 @@ jobs:
cd /tmp/arm64/zip
zip -r /tmp/arm64/linux-ubuntu-22.04_${{ github.event.release.tag_name }}_arm64.zip .
- name: Pull and extract files from Docker image (armhf)
continue-on-error: true
if: ${{ env.DOCKER_ARMHF_EXPERIMENTAL == 'enabled' }}
run: |
export TAG=${{ github.event.release.tag_name }}
mkdir -p /tmp/armhf/zip
docker pull ${{ secrets.DOCKER_IMAGE }}-integration:latest
docker create --platform linux/armhf --name temp-container-armhf ${{ secrets.DOCKER_IMAGE }}-integration:latest
docker cp temp-container-armhf:/usr/local/share/debpackages/rustdesk-server-hbbr_${{ github.event.release.tag_name }}_armhf.deb /tmp/armhf/
docker cp temp-container-armhf:/usr/local/share/debpackages/rustdesk-server-hbbs_${{ github.event.release.tag_name }}_armhf.deb /tmp/armhf/
docker cp temp-container-armhf:/usr/local/share/debpackages/rustdesk-server-utils_${{ github.event.release.tag_name }}_armhf.deb /tmp/armhf/
docker cp temp-container-armhf:/usr/local/bin/hbbs /tmp/armhf/zip/
docker cp temp-container-armhf:/usr/local/bin/hbbr /tmp/armhf/zip/
docker cp temp-container-armhf:/usr/local/bin/rustdesk-utils /tmp/armhf/zip/
docker rm temp-container-armhf
cd /tmp/armhf/zip
zip -r /tmp/armhf/linux-ubuntu-22.04_${{ github.event.release.tag_name }}_armhf.zip .
- name: Upload Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -137,6 +160,16 @@ jobs:
gh release upload ${{ github.event.release.tag_name }} /tmp/amd64/rustdesk-server-hbbs_${{ github.event.release.tag_name }}_amd64.deb
gh release upload ${{ github.event.release.tag_name }} /tmp/amd64/rustdesk-server-utils_${{ github.event.release.tag_name }}_amd64.deb
- name: Upload armhf release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ env.DOCKER_ARMHF_EXPERIMENTAL == 'enabled' }}
run: |
gh release upload ${{ github.event.release.tag_name }} /tmp/armhf/linux-ubuntu-22.04_${{ github.event.release.tag_name }}_armhf.zip
gh release upload ${{ github.event.release.tag_name }} /tmp/armhf/rustdesk-server-hbbr_${{ github.event.release.tag_name }}_armhf.deb
gh release upload ${{ github.event.release.tag_name }} /tmp/armhf/rustdesk-server-hbbs_${{ github.event.release.tag_name }}_armhf.deb
gh release upload ${{ github.event.release.tag_name }} /tmp/armhf/rustdesk-server-utils_${{ github.event.release.tag_name }}_armhf.deb
- name: Extract metadata (tags, labels) for Docker integration image
id: meta
uses: docker/metadata-action@v5
Expand All @@ -149,7 +182,7 @@ jobs:
with:
context: .
file: ./Dockerfile
platforms: linux/arm64, linux/amd64
platforms: linux/arm64, linux/amd64, linux/armhf
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
Expand All @@ -175,4 +208,11 @@ jobs:
uses: actions/attest-build-provenance@v1
continue-on-error: true
with:
subject-path: '/tmp/arm64/linux-ubuntu-22.04_${{ github.event.release.tag_name }}_arm64.zip, /tmp/arm64/rustdesk-server-hbbr_${{ github.event.release.tag_name }}_arm64.deb, /tmp/arm64/rustdesk-server-hbbs_${{ github.event.release.tag_name }}_arm64.deb, /tmp/arm64/rustdesk-server-utils_${{ github.event.release.tag_name }}_arm64.deb, /tmp/arm64/zip/hbbs, /tmp/arm64/zip/hbbr, /tmp/arm64/zip/rustdesk-utils'
subject-path: '/tmp/arm64/linux-ubuntu-22.04_${{ github.event.release.tag_name }}_arm64.zip, /tmp/arm64/rustdesk-server-hbbr_${{ github.event.release.tag_name }}_arm64.deb, /tmp/arm64/rustdesk-server-hbbs_${{ github.event.release.tag_name }}_arm64.deb, /tmp/arm64/rustdesk-server-utils_${{ github.event.release.tag_name }}_arm64.deb, /tmp/arm64/zip/hbbs, /tmp/arm64/zip/hbbr, /tmp/arm64/zip/rustdesk-utils'

- name: Attest release armhf
uses: actions/attest-build-provenance@v1
if: ${{ env.DOCKER_ARMHF_EXPERIMENTAL == 'enabled' }}
continue-on-error: true
with:
subject-path: '/tmp/armhf/linux-ubuntu-22.04_${{ github.event.release.tag_name }}_armhf.zip, /tmp/armhf/rustdesk-server-hbbr_${{ github.event.release.tag_name }}_armhf.deb, /tmp/armhf/rustdesk-server-hbbs_${{ github.event.release.tag_name }}_armhf.deb, /tmp/armhf/rustdesk-server-utils_${{ github.event.release.tag_name }}_armhf.deb, /tmp/armhf/zip/hbbs, /tmp/armhf/zip/hbbr, /tmp/armhf/zip/rustdesk-utils'
25 changes: 19 additions & 6 deletions Dockerfile-integration
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# syntax=docker/dockerfile:experimental
# Copyright 2024 SCTG Development - Ronan LE MEILLAT
# SPDX-License-Identifier: AGPL-3.0-or-later
FROM ubuntu:jammy AS builder
FROM node:lts-bookworm AS builder
ENV NODE_VERSION=20.18.0
RUN apt-get update && apt-get install -y curl build-essential debhelper devscripts pkg-config libssl-dev zip
RUN apt-get update && apt-get install -y curl build-essential debhelper devscripts pkg-config libssl-dev zip git sqlite3
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN mkdir /build
COPY src /build/src
Expand All @@ -11,12 +12,23 @@ COPY Cargo.toml /build/Cargo.toml
COPY Cargo.lock /build/Cargo.lock
COPY build.rs /build/build.rs
COPY db_v2.sqlite3 /build/db_v2.sqlite3
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash \
&& . /root/.nvm/nvm.sh && nvm install ${NODE_VERSION} && nvm use ${NODE_VERSION} \
# Ensure the database contains a test peer
RUN echo "INSERT OR IGNORE INTO peer (guid, id, uuid, pk, created_at, 'user', status, note, region, strategy, info, last_online) VALUES(x'018f255622f77778a006702ca5c23715', 'TESTUSER', randomblob(16), randomblob(16), '1901-01-01 12:00:00', randomblob(16), 0, '', NULL, randomblob(16), '{}', '1901-01-01 12:00:00');" | sqlite3 /build/db_v2.sqlite3
# Set up cargo config to use git tool
# this workaround is needed because QEMU emulating 32 bits platfom on 64 bits host
# see https://github.com/rust-lang/cargo/issues/8719
RUN mv /root/.cargo /tmp && rm -rf /root/.cargo && mkdir -p /root/.cargo
RUN --mount=type=tmpfs,target=/root/.cargo mkdir -p /root/.cargo \
&& cp -av /tmp/.cargo/* /root/.cargo/ && ls -lR /root/.cargo \
&& if [ ! -f /root/.cargo/config.toml ]; then \
echo "" > /root/.cargo/config.toml; \
fi && \
awk 'BEGIN{net_section=0;git_fetch_found=0;printed=0}/^\[net\]/{net_section=1;print;next}/^\[/{if(net_section&&!git_fetch_found){print "git-fetch-with-cli = true";printed=1}net_section=0;print;next}net_section&&/^git-fetch-with-cli\s*=/{print "git-fetch-with-cli = true";git_fetch_found=1;next}{print}END{if(!printed&&!git_fetch_found){if(!net_section)print "\n[net]";print "git-fetch-with-cli = true"}}' /root/.cargo/config.toml > /root/.cargo/config.tmp && \
mv /root/.cargo/config.tmp /root/.cargo/config.toml \
&& . /root/.cargo/env && cd /build \
&& cargo update -p sctgdesk-api-server \
&& DATABASE_URL=sqlite://$(pwd)/db_v2.sqlite3 cargo build --release
RUN mkdir -p /build/ubuntu-jammy/bin \
&& DATABASE_URL=sqlite://$(pwd)/db_v2.sqlite3 cargo build --release \
&& mkdir -p /build/ubuntu-jammy/bin \
&& cp /build/target/release/hbbr /build/ubuntu-jammy/bin/ \
&& cp /build/target/release/hbbs /build/ubuntu-jammy/bin/ \
&& cp /build/target/release/rustdesk-utils /build/ubuntu-jammy/bin/
Expand All @@ -28,6 +40,7 @@ RUN cd /build/ubuntu-jammy \
&& debuild -i -us -uc -b -a$(dpkg --print-architecture)
COPY oauth2.toml /build/ubuntu-jammy/bin/oauth2.toml

# Note ubuntu:jammy is the based on Debian:bookworm so the deb packages and the binaried are compatible
FROM ubuntu:jammy
RUN mkdir -p /usr/local/share/debpackages
COPY --from=builder /build/*.deb /usr/local/share/debpackages
Expand Down

0 comments on commit c52cd17

Please sign in to comment.