mirror of
https://github.com/element-hq/element-desktop
synced 2025-03-13 07:48:39 +01:00
Use docker command only around native build
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
4dad0a9785
commit
303f9cb411
10
.github/workflows/build_and_test.yaml
vendored
10
.github/workflows/build_and_test.yaml
vendored
@ -45,6 +45,15 @@ jobs:
|
||||
with:
|
||||
files: |
|
||||
dockerbuild/**
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3
|
||||
with:
|
||||
install: true
|
||||
|
||||
- name: Log in to the Container registry
|
||||
if: steps.changed_files.outputs.any_modified == 'true'
|
||||
uses: docker/login-action@5f4866a30a54f16a52d2ecb4a3898e9e424939cf
|
||||
@ -68,6 +77,7 @@ jobs:
|
||||
context: dockerbuild
|
||||
push: true
|
||||
tags: ${{ steps.docker.outputs.image }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
linux:
|
||||
needs:
|
||||
|
41
.github/workflows/build_linux.yaml
vendored
41
.github/workflows/build_linux.yaml
vendored
@ -27,8 +27,6 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ inputs.docker-image || format('ghcr.io/element-hq/element-desktop-dockerbuild:{0}', github.ref_name == 'master' && 'master' || 'develop') }}
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
@ -47,7 +45,8 @@ jobs:
|
||||
"arm64": {
|
||||
"target": "aarch64-unknown-linux-gnu",
|
||||
"arch": "aarch64",
|
||||
"build-args": "--arm64"
|
||||
"build-args": "--arm64",
|
||||
"docker-args": "--env-file ./dockerbuild/aarch64/.env"
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,30 +76,24 @@ jobs:
|
||||
- name: Install Deps
|
||||
run: "yarn install --frozen-lockfile"
|
||||
|
||||
- name: Prepare for static sqlcipher build
|
||||
if: inputs.sqlcipher == 'static'
|
||||
run: |
|
||||
echo "SQLCIPHER_BUNDLED=1" >> $GITHUB_ENV
|
||||
|
||||
- name: Prepare for cross compilation
|
||||
if: steps.cache.outputs.cache-hit != 'true' && inputs.arch == 'arm64'
|
||||
run: |
|
||||
rustup target add aarch64-unknown-linux-gnu
|
||||
mv dockerbuild/aarch64/.cargo .
|
||||
cat dockerbuild/aarch64/.env >> $GITHUB_ENV
|
||||
|
||||
# Ideally the docker image would be ready for cross-compilation but libsqlcipher-dev is not Multi-Arch compatible
|
||||
# https://unix.stackexchange.com/a/349359
|
||||
- name: Prepare for cross compilation (dynamic)
|
||||
if: steps.cache.outputs.cache-hit != 'true' && inputs.arch == 'arm64' && inputs.sqlcipher == 'system'
|
||||
run: |
|
||||
dpkg --add-architecture arm64
|
||||
apt-get -qq update
|
||||
apt-get -qq install --no-install-recommends libsqlcipher-dev:arm64 libssl-dev:arm64 libsecret-1-dev:arm64
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
if: steps.cache.outputs.cache-hit != 'true' && inputs.arch != 'amd64'
|
||||
with:
|
||||
platforms: ${{ matrix.arch }}
|
||||
|
||||
- name: Build Natives
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: "yarn build:native --target ${{ steps.config.outputs.target }}"
|
||||
run: |
|
||||
docker run \
|
||||
--rm \
|
||||
-v $(pwd):/${{ github.workspace }} \
|
||||
-w ${{ github.workspace }} \
|
||||
--platform linux/${{ matrix.arch }} \
|
||||
${{ inputs.docker-image || format('ghcr.io/element-hq/element-desktop-dockerbuild:{0}', github.ref_name == 'master' && 'master' || 'develop') }} \
|
||||
${{ steps.config.outputs.docker-args }} \
|
||||
-e SQLCIPHER_BUNDLED=${{ inputs.sqlcipher == 'static' && '1' || '0' }} \
|
||||
yarn build:native --target ${{ steps.config.outputs.target }}
|
||||
|
||||
- name: "[Nightly] Resolve version"
|
||||
if: inputs.version != ''
|
||||
|
9
.github/workflows/dockerbuild.yaml
vendored
9
.github/workflows/dockerbuild.yaml
vendored
@ -19,6 +19,14 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3
|
||||
with:
|
||||
install: true
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@5f4866a30a54f16a52d2ecb4a3898e9e424939cf
|
||||
with:
|
||||
@ -41,3 +49,4 @@ jobs:
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
@ -3,6 +3,9 @@ FROM buildpack-deps:buster-curl
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
# For DinD to work
|
||||
COPY --from=docker:dind /usr/local/bin/docker /usr/local/bin/
|
||||
|
||||
RUN curl --proto "=https" -L https://yarnpkg.com/latest.tar.gz | tar xvz && mv yarn-* /yarn && ln -s /yarn/bin/yarn /usr/bin/yarn
|
||||
RUN apt-get -qq update && apt-get -qq dist-upgrade && \
|
||||
# add repo for git-lfs
|
||||
@ -19,8 +22,6 @@ RUN apt-get -qq update && apt-get -qq dist-upgrade && \
|
||||
jq grep file \
|
||||
# Used by seshat (when not SQLCIPHER_STATIC) \
|
||||
libsqlcipher-dev && \
|
||||
# Used for cross-compilation
|
||||
crossbuild-essential-arm64 \
|
||||
# git-lfs
|
||||
git lfs install && \
|
||||
apt-get purge -y --auto-remove && rm -rf /var/lib/apt/lists/*
|
||||
@ -47,3 +48,7 @@ ENV RUSTUP_HOME=/usr/local/rustup \
|
||||
PATH=/usr/local/cargo/bin:$PATH
|
||||
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal
|
||||
|
||||
# Run platform-specific tasks
|
||||
ADD COPY ./dockerbuild/ /dockerbuild/
|
||||
RUN /dockerbuild/aarch64.sh
|
||||
|
9
dockerbuild/aarch64.sh
Executable file
9
dockerbuild/aarch64.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ "$TARGETPLATFORM" = "linux/arm64" ]; then
|
||||
echo "Building for aarch64"
|
||||
apt-get -qq update
|
||||
apt-get -y install crossbuild-essential-arm64 libsqlcipher-dev:arm64 libssl-dev:arm64 libsecret-1-dev:arm64
|
||||
rustup target add aarch64-unknown-linux-gnu
|
||||
mv /dockerbuild/aarch64/.cargo .
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user