Skip to content

Commit

Permalink
devcontainer: Build with multi-architecture manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
barrbrain committed Dec 1, 2023
1 parent 95cd6a4 commit 96873ae
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 3 deletions.
File renamed without changes.
23 changes: 23 additions & 0 deletions .devcontainer/Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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
RUN export CARGO_PROFILE_RELEASE_STRIP=true \
&& 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
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

0 comments on commit 96873ae

Please sign in to comment.