Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devcontainer: Update and add support for arm64 hosts #3282

Merged
merged 3 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .devcontainer/Dockerfile → .devcontainer/Dockerfile.amd64
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
FROM mcr.microsoft.com/devcontainers/rust:1-1-bookworm
FROM mcr.microsoft.com/devcontainers/rust:dev-1-bookworm
RUN dpkg --add-architecture arm64 \
&& apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y --no-install-recommends \
libaom-dev libdav1d-dev libaom-dev:arm64 libdav1d-dev:arm64 \
libclang-dev libgit2-dev libcurl4-openssl-dev libfuzzer-14-dev \
gcc-aarch64-linux-gnu libc6-dev-arm64-cross nasm dav1d qemu-user \
meson ninja-build \
&& rm -rf /var/lib/apt/lists/*
RUN rustup target add aarch64-unknown-linux-gnu
RUN export CARGO_PROFILE_RELEASE_STRIP=true \
&& cargo install -q cargo-c \
&& cargo install -q cargo-criterion \
&& cargo install -q cargo-fuzz \
&& cargo install -q cargo-c --version "0.9.27+cargo-0.74.0" \
&& cargo install -q cargo-criterion --version "1.1.0" \
&& cargo install -q cargo-fuzz --version "0.11.2" \
&& rm -rf /usr/local/cargo/registry
RUN SDE=sde-external-9.14.0-2022-10-25-lin \
&& curl -sSf https://downloadmirror.intel.com/751535/$SDE.tar.xz | tar Jx -C /opt \
RUN SDE=sde-external-9.27.0-2023-09-13-lin \
&& curl -sSf https://downloadmirror.intel.com/788820/$SDE.tar.xz | tar Jx -C /opt \
&& ln -sv /opt/$SDE/sde64 /usr/local/bin/sde64
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER=qemu-aarch64
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS=-Clinker=aarch64-linux-gnu-gcc
Expand Down
39 changes: 39 additions & 0 deletions .devcontainer/Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/devcontainers/rust:dev-1-bookworm AS cargo-applets
ARG CARGO_BUILD_TARGET=aarch64-unknown-linux-gnu
ARG CARGO_INSTALL_ROOT=/opt/cargo
ARG CARGO_PROFILE_RELEASE_STRIP=true
ARG CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS=-Clinker=aarch64-linux-gnu-gcc
ARG PKG_CONFIG_ALLOW_CROSS_aarch64_unknown_linux_gnu=1
ARG PKG_CONFIG_PATH_aarch64_unknown_linux_gnu=/usr/lib/aarch64-linux-gnu/pkgconfig
ARG PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_gnu=/
RUN rustup target add aarch64-unknown-linux-gnu
RUN dpkg --add-architecture arm64 \
&& apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y --no-install-recommends \
gcc-aarch64-linux-gnu libc6-dev-arm64-cross \
libcurl4-openssl-dev:arm64 libssl-dev:arm64 zlib1g-dev:arm64 \
&& rm -rf /var/lib/apt/lists/*
RUN cargo install cargo-c --version "0.9.27+cargo-0.74.0" \
&& cargo install cargo-criterion --version "1.1.0" \
&& cargo install cargo-fuzz --version "0.11.2" \
&& rm -rf /usr/local/cargo/registry

FROM mcr.microsoft.com/devcontainers/rust:dev-1-bookworm
RUN dpkg --add-architecture amd64 \
&& apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y --no-install-recommends \
libaom-dev libdav1d-dev libaom-dev:amd64 libdav1d-dev:amd64 \
libclang-dev libgit2-dev libcurl4-openssl-dev libfuzzer-14-dev \
gcc-x86-64-linux-gnu libc6-dev-amd64-cross nasm dav1d qemu-user \
meson ninja-build \
&& rm -rf /var/lib/apt/lists/*
RUN rustup target add x86_64-unknown-linux-gnu
COPY --from=cargo-applets /opt/cargo /usr/local/cargo
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER=qemu-x86_64
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS=-Clinker=x86_64-linux-gnu-gcc
ENV PKG_CONFIG_ALLOW_CROSS_x86_64_unknown_linux_gnu=1
ENV PKG_CONFIG_PATH_x86_64_unknown_linux_gnu=/usr/lib/x64_64-linux-gnu/pkgconfig
ENV PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu=/
ENV CUSTOM_LIBFUZZER_PATH=/usr/lib/llvm-14/lib/libFuzzer.a
LABEL dev.containers.source=https://github.com/xiph/rav1e
LABEL dev.containers.id=rav1e
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rav1e-devcontainer",
"build": {
"dockerfile": "Dockerfile"
"dockerfile": "Dockerfile.amd64"
}
}
6 changes: 6 additions & 0 deletions .devcontainer/build-arm64.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "rav1e-devcontainer",
"build": {
"dockerfile": "Dockerfile.arm64"
}
}
12 changes: 10 additions & 2 deletions .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
- uses: actions/checkout@v4
- name: Install devcontainer-cli
run: npm install -g @devcontainers/cli
- name: Register qemu binfmt-misc entries for Docker
run: docker run --privileged --rm tonistiigi/binfmt --install aarch64
- name: Authenticate with ghcr.io
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Build devcontainer image
Expand All @@ -28,5 +30,11 @@ jobs:
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
VERSION=latest
IMAGE_TAG=${IMAGE_ID,,}:$VERSION
devcontainer build --image-name $IMAGE_TAG --push \
--workspace-folder $PWD --config .devcontainer/build.json
devcontainer build --image-name $IMAGE_TAG-amd64 --platform linux/amd64 --push \
--workspace-folder $PWD --config .devcontainer/build-amd64.json
devcontainer build --image-name $IMAGE_TAG-arm64 --platform linux/arm64 --push \
--workspace-folder $PWD --config .devcontainer/build-arm64.json
docker manifest create $IMAGE_TAG \
--amend $IMAGE_TAG-amd64 \
--amend $IMAGE_TAG-arm64
docker manifest push $IMAGE_TAG
Loading