-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cfc8ea2
commit a4255dc
Showing
3 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
|
||
jobs: | ||
build-docker-single-arch: | ||
name: build-docker-${{ matrix.cpu_arch }} | ||
strategy: | ||
matrix: | ||
cpu_arch: [aarch64, x86_64] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Update Rust | ||
run: rustup update stable | ||
- name: Dockerhub login | ||
run: | | ||
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin | ||
- name: Cross build binaries | ||
run: | | ||
cargo install cross | ||
make build-${{ matrix.arch }} | ||
- name: Make bin dir | ||
run: mkdir ./bin | ||
|
||
- name: Move cross-built binary into Docker scope | ||
run: mv ./target/${{ matrix.cpu_arch }}-unknown-linux-gnu/release/eleel ./bin | ||
|
||
- name: Map aarch64 to arm64 short arch | ||
if: startsWith(matrix.cpu_arch, 'aarch64') | ||
run: echo "SHORT_ARCH=arm64" >> $GITHUB_ENV | ||
|
||
- name: Map x86_64 to amd64 short arch | ||
if: startsWith(matrix.cpu_arch, 'x86_64') | ||
run: echo "SHORT_ARCH=amd64" >> $GITHUB_ENV | ||
|
||
- name: Install QEMU | ||
run: sudo apt-get update && sudo apt-get install -y qemu-user-static | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: ./Dockerfile.cross | ||
context: . | ||
platforms: linux/${{ env.SHORT_ARCH }} | ||
push: true | ||
tags: | | ||
${{ github.repository_owner }}/eleel:latest-${{ env.SHORT_ARCH }} | ||
build-docker-multiarch: | ||
name: build-docker-eleel-multiarch | ||
runs-on: ubuntu-22.04 | ||
needs: [build-docker-single-arch] | ||
steps: | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Dockerhub login | ||
run: | | ||
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin | ||
- name: Create and push multiarch manifests | ||
run: | | ||
docker buildx imagetools create -t ${{ github.repository_owner}}/eleel:latest \ | ||
${{ github.repository_owner}}/eleel:latest-arm64 \ | ||
${{ github.repository_owner}}/eleel:latest-amd64; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# This image is meant to enable cross-architecture builds. | ||
# It assumes the eleel binary has already been | ||
# compiled for `$TARGETPLATFORM` and moved to `./bin`. | ||
FROM --platform=$TARGETPLATFORM ubuntu:24.04 | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
libssl-dev \ | ||
ca-certificates \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
COPY ./bin/lighthouse /usr/local/bin/lighthouse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
build-x86_64: | ||
cross build --bin eleel --target x86_64-unknown-linux-gnu --profile release --locked | ||
|
||
build-x86_64: | ||
cross build --bin eleel --target x86_64-unknown-linux-gnu --profile release --locked |