diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16e83c6d2..7b52d0a41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,6 +75,7 @@ jobs: - name: Run unit tests run: cargo test --locked --all-targets --workspace --all-features timeout-minutes: 10 + check: runs-on: ubuntu-latest outputs: @@ -84,6 +85,7 @@ jobs: - uses: ./.github/actions/setup-rust - run: cargo xtask ci-job check id: check + generate-matrix: runs-on: ubuntu-latest outputs: @@ -99,10 +101,109 @@ jobs: COMMIT_MESSAGE: ${{ github.event.head_commit.message }} COMMIT_AUTHOR: ${{ github.event.head_commit.author.username }} + build-base: + name: ${{ matrix.image }} (${{ matrix.sub }}) + runs-on: ubuntu-latest + needs: [shellcheck, test, check] + if: github.event_name == 'push' + strategy: + fail-fast: false + matrix: + image: + - base + sub: + - ubuntu + - centos + - emscripten + outputs: + coverage-artifact: ${{ steps.cov.outputs.artifact-name }} + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/setup-rust + + - name: Set up Docker Buildx + if: runner.os == 'Linux' + uses: docker/setup-buildx-action@v1 + + - name: Build xtask + run: cargo build -p xtask + + - name: Prepare Meta + id: prepare-meta + timeout-minutes: 60 + run: cargo xtask ci-job prepare-meta "${IMAGE}.${SUB}" + env: + IMAGE: ${{ matrix.image }} + SUB: ${{ matrix.sub }} + shell: bash + + - name: LLVM instrument coverage + uses: ./.github/actions/cargo-llvm-cov + with: + name: cross-${{matrix.image}}-${{matrix.sub}} + + - name: Install cross + if: matrix.deploy + run: cargo install --path . --force --debug + + - name: Docker Meta + id: docker-meta + uses: docker/metadata-action@v4 + with: + images: | + name=${{ steps.prepare-meta.outputs.image }} + labels: | + ${{ fromJSON(steps.prepare-meta.outputs.labels) }} + + # always use the main branch, since we need it for the base image + - name: Build Docker image + id: build-docker-image + timeout-minutes: 60 + run: cargo xtask build-docker-image -v --tag main "${IMAGE}.${SUB}" + env: + IMAGE: ${{ matrix.image }} + SUB: ${{ matrix.sub }} + LABELS: ${{ steps.docker-meta.outputs.labels }} + LATEST: ${{ needs.check.outputs.is-latest || 'false' }} + shell: bash + + - name: Save Docker Image + id: save-docker-image + run: docker save "ghcr.io/cross-rs/${IMAGE}:main-${SUB}" -o "${IMAGE}-main-${SUB}.tar" + env: + IMAGE: ${{ matrix.image }} + SUB: ${{ matrix.sub }} + + - uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.image }}-${{ matrix.sub }}-image-tarball + path: ${{ matrix.image }}-main-${{ matrix.sub }}.tar + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push image to GitHub Container Registry + if: > + ( + github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || + startsWith(github.ref, 'refs/tags/v') + ) + run: cargo xtask build-docker-image -v "${IMAGE}.${SUB}" + env: + IMAGE: ${{ matrix.image }} + SUB: ${{ matrix.sub }} + LABELS: ${{ steps.docker-meta.outputs.labels }} + LATEST: ${{ needs.check.outputs.is-latest || 'false' }} + shell: bash + build: name: target (${{ matrix.pretty }},${{ matrix.os }}) runs-on: ${{ matrix.os }} - needs: [shellcheck, test, generate-matrix, check] + needs: [shellcheck, test, generate-matrix, check, build-base] if: github.event_name == 'push' && needs.generate-matrix.outputs.matrix != '{}' && needs.generate-matrix.outputs.matrix != '[]' && needs.generate-matrix.outputs.matrix != '' strategy: fail-fast: false @@ -114,7 +215,6 @@ jobs: coverage-artifact: ${{ steps.cov.outputs.artifact-name }} steps: - uses: actions/checkout@v3 - - uses: ./.github/actions/setup-rust - name: Set up Docker Buildx @@ -153,6 +253,33 @@ jobs: name=${{ steps.prepare-meta.outputs.image }} labels: | ${{ fromJSON(steps.prepare-meta.outputs.labels) }} + + - name: Set env Base Image + if: steps.prepare-meta.outputs.has-image + run: | + if [[ "${SUB}" == "centos" ]]; then + echo "BASE=centos" >> "${GITHUB_ENV}" + elif [[ "${TARGET}" == *emscripten ]]; then + echo "BASE=emscripten" >> "${GITHUB_ENV}" + else + echo "BASE=ubuntu" >> "${GITHUB_ENV}" + fi + env: + TARGET: ${{ matrix.target }} + SUB: ${{ matrix.sub }} + + - uses: actions/download-artifact@v3 + if: steps.prepare-meta.outputs.has-image + with: + name: base-${{ env.BASE }}-image-tarball + + - name: Load Base Image + id: load-docker-image + if: steps.prepare-meta.outputs.has-image + run: docker load --input "base-main-${BASE}.tar" + env: + SUB: ${{ matrix.sub }} + - name: Build Docker image id: build-docker-image if: steps.prepare-meta.outputs.has-image @@ -163,7 +290,9 @@ jobs: SUB: ${{ matrix.sub }} LABELS: ${{ steps.docker-meta.outputs.labels }} LATEST: ${{ needs.check.outputs.is-latest || 'false' }} + CROSS_CONTAINER_ENGINE_NO_PULL: true shell: bash + - name: Set Docker image for test if: steps.prepare-meta.outputs.has-image run: | @@ -173,6 +302,7 @@ jobs: TARGET: ${{ matrix.target }} IMAGE: ${{ steps.build-docker-image.outputs.image }} shell: bash + - name: Test Image if: steps.prepare-meta.outputs.has-image && steps.prepare-meta.outputs.test-variant == 'default' run: ./ci/test.sh @@ -185,6 +315,7 @@ jobs: RUN: ${{ matrix.run }} RUNNERS: ${{ matrix.runners }} shell: bash + - uses: ./.github/actions/cargo-install-upload-artifacts if: matrix.deploy with: @@ -210,6 +341,7 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Push image to GitHub Container Registry if: > steps.prepare-meta.outputs.has-image && ( @@ -275,15 +407,18 @@ jobs: uses: ./.github/actions/cargo-llvm-cov with: name: integration-bisect + - name: Set up QEMU uses: docker/setup-qemu-action@v2 with: platforms: arm64 + - name: Set up docker buildx uses: docker/setup-buildx-action@v2 id: buildx with: install: true + - name: Run Foreign toolchain test run: ./ci/test-foreign-toolchain.sh shell: bash @@ -321,7 +456,6 @@ jobs: coverage-artifact: ${{ steps.cov.outputs.artifact-name }} steps: - uses: actions/checkout@v3 - - uses: ./.github/actions/setup-rust - name: Install Podman @@ -348,7 +482,7 @@ jobs: shell: bash publish: - needs: [build, check, fmt, clippy, cargo-deny] + needs: [build-base, build, check, fmt, clippy, cargo-deny] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -359,7 +493,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} conclusion: - needs: [shellcheck, fmt, clippy, test, generate-matrix, build, publish, check, remote, bisect, docker-in-docker, foreign, podman] + needs: [shellcheck, fmt, clippy, test, generate-matrix, build-base, build, publish, check, remote, bisect, docker-in-docker, foreign, podman] if: always() runs-on: ubuntu-latest steps: diff --git a/docker/Dockerfile.aarch64-linux-android b/docker/Dockerfile.aarch64-linux-android index ea85d5d51..b806e59a1 100644 --- a/docker/Dockerfile.aarch64-linux-android +++ b/docker/Dockerfile.aarch64-linux-android @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY android-ndk.sh / RUN /android-ndk.sh arm64 28 ENV PATH=$PATH:/android-ndk/bin diff --git a/docker/Dockerfile.aarch64-unknown-linux-gnu b/docker/Dockerfile.aarch64-unknown-linux-gnu index 2480cd6da..87e043877 100644 --- a/docker/Dockerfile.aarch64-unknown-linux-gnu +++ b/docker/Dockerfile.aarch64-unknown-linux-gnu @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ g++-aarch64-linux-gnu \ libc6-dev-arm64-cross diff --git a/docker/Dockerfile.aarch64-unknown-linux-gnu.centos b/docker/Dockerfile.aarch64-unknown-linux-gnu.centos index 5fef9a310..3c9c805f1 100644 --- a/docker/Dockerfile.aarch64-unknown-linux-gnu.centos +++ b/docker/Dockerfile.aarch64-unknown-linux-gnu.centos @@ -6,16 +6,7 @@ COPY lib.sh / COPY linux-image.sh / RUN /linux-image.sh aarch64 -FROM centos:7 - -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh +FROM ghcr.io/cross-rs/base:main-centos COPY qemu.sh / RUN /qemu.sh aarch64 softmmu diff --git a/docker/Dockerfile.aarch64-unknown-linux-musl b/docker/Dockerfile.aarch64-unknown-linux-musl index 7dc97b794..cb43593d2 100644 --- a/docker/Dockerfile.aarch64-unknown-linux-musl +++ b/docker/Dockerfile.aarch64-unknown-linux-musl @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY qemu.sh / RUN /qemu.sh aarch64 diff --git a/docker/Dockerfile.arm-linux-androideabi b/docker/Dockerfile.arm-linux-androideabi index 3faae941d..c5d41dc52 100644 --- a/docker/Dockerfile.arm-linux-androideabi +++ b/docker/Dockerfile.arm-linux-androideabi @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY android-ndk.sh / RUN /android-ndk.sh arm 28 ENV PATH=$PATH:/android-ndk/bin diff --git a/docker/Dockerfile.arm-unknown-linux-gnueabi b/docker/Dockerfile.arm-unknown-linux-gnueabi index db370a6f1..c38b39215 100644 --- a/docker/Dockerfile.arm-unknown-linux-gnueabi +++ b/docker/Dockerfile.arm-unknown-linux-gnueabi @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ g++-arm-linux-gnueabi \ libc6-dev-armel-cross diff --git a/docker/Dockerfile.arm-unknown-linux-gnueabihf b/docker/Dockerfile.arm-unknown-linux-gnueabihf index e5217c305..1b25bcc52 100644 --- a/docker/Dockerfile.arm-unknown-linux-gnueabihf +++ b/docker/Dockerfile.arm-unknown-linux-gnueabihf @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - ARG VERBOSE COPY crosstool-ng.sh / COPY crosstool-config/arm-unknown-linux-gnueabihf.config / diff --git a/docker/Dockerfile.arm-unknown-linux-musleabi b/docker/Dockerfile.arm-unknown-linux-musleabi index 1fbbe8ec3..d684384c8 100644 --- a/docker/Dockerfile.arm-unknown-linux-musleabi +++ b/docker/Dockerfile.arm-unknown-linux-musleabi @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY qemu.sh / RUN /qemu.sh arm diff --git a/docker/Dockerfile.arm-unknown-linux-musleabihf b/docker/Dockerfile.arm-unknown-linux-musleabihf index e7ae93732..f13226e6c 100644 --- a/docker/Dockerfile.arm-unknown-linux-musleabihf +++ b/docker/Dockerfile.arm-unknown-linux-musleabihf @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY qemu.sh / RUN /qemu.sh arm diff --git a/docker/Dockerfile.armv5te-unknown-linux-gnueabi b/docker/Dockerfile.armv5te-unknown-linux-gnueabi index 91ab30df5..36b239ecb 100644 --- a/docker/Dockerfile.armv5te-unknown-linux-gnueabi +++ b/docker/Dockerfile.armv5te-unknown-linux-gnueabi @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ g++-arm-linux-gnueabi \ crossbuild-essential-armel \ diff --git a/docker/Dockerfile.armv5te-unknown-linux-musleabi b/docker/Dockerfile.armv5te-unknown-linux-musleabi index 5e8ef3b3b..df2fea318 100644 --- a/docker/Dockerfile.armv5te-unknown-linux-musleabi +++ b/docker/Dockerfile.armv5te-unknown-linux-musleabi @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY qemu.sh / RUN /qemu.sh arm diff --git a/docker/Dockerfile.armv7-linux-androideabi b/docker/Dockerfile.armv7-linux-androideabi index 3b2b2760d..f965d7d97 100644 --- a/docker/Dockerfile.armv7-linux-androideabi +++ b/docker/Dockerfile.armv7-linux-androideabi @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY android-ndk.sh / RUN /android-ndk.sh arm 28 ENV PATH=$PATH:/android-ndk/bin diff --git a/docker/Dockerfile.armv7-unknown-linux-gnueabi b/docker/Dockerfile.armv7-unknown-linux-gnueabi index 770433886..c96764315 100644 --- a/docker/Dockerfile.armv7-unknown-linux-gnueabi +++ b/docker/Dockerfile.armv7-unknown-linux-gnueabi @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN apt-get install --assume-yes --no-install-recommends \ g++-arm-linux-gnueabi \ libc6-dev-armel-cross diff --git a/docker/Dockerfile.armv7-unknown-linux-gnueabihf b/docker/Dockerfile.armv7-unknown-linux-gnueabihf index f532b8658..f1d41c653 100644 --- a/docker/Dockerfile.armv7-unknown-linux-gnueabihf +++ b/docker/Dockerfile.armv7-unknown-linux-gnueabihf @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ g++-arm-linux-gnueabihf \ libc6-dev-armhf-cross diff --git a/docker/Dockerfile.armv7-unknown-linux-musleabi b/docker/Dockerfile.armv7-unknown-linux-musleabi index d03bddb73..b96d955c4 100644 --- a/docker/Dockerfile.armv7-unknown-linux-musleabi +++ b/docker/Dockerfile.armv7-unknown-linux-musleabi @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY qemu.sh / RUN /qemu.sh arm diff --git a/docker/Dockerfile.armv7-unknown-linux-musleabihf b/docker/Dockerfile.armv7-unknown-linux-musleabihf index fb85b0285..eaae2ed48 100644 --- a/docker/Dockerfile.armv7-unknown-linux-musleabihf +++ b/docker/Dockerfile.armv7-unknown-linux-musleabihf @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY qemu.sh / RUN /qemu.sh arm diff --git a/docker/Dockerfile.asmjs-unknown-emscripten b/docker/Dockerfile.asmjs-unknown-emscripten index 31781fcb5..1a07ab72d 100644 --- a/docker/Dockerfile.asmjs-unknown-emscripten +++ b/docker/Dockerfile.asmjs-unknown-emscripten @@ -1,16 +1,6 @@ -FROM emscripten/emsdk:3.1.14 -WORKDIR / +FROM ghcr.io/cross-rs/base:main-emscripten ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN apt-get update && apt-get update && apt-get install --assume-yes --no-install-recommends \ libxml2 \ python diff --git a/docker/Dockerfile.base.centos b/docker/Dockerfile.base.centos new file mode 100644 index 000000000..86137653b --- /dev/null +++ b/docker/Dockerfile.base.centos @@ -0,0 +1,10 @@ +FROM centos:7 + +COPY common.sh lib.sh / +RUN /common.sh + +COPY cmake.sh / +RUN /cmake.sh + +COPY xargo.sh / +RUN /xargo.sh diff --git a/docker/Dockerfile.base.emscripten b/docker/Dockerfile.base.emscripten new file mode 100644 index 000000000..131d7fc4a --- /dev/null +++ b/docker/Dockerfile.base.emscripten @@ -0,0 +1,12 @@ +FROM emscripten/emsdk:3.1.14 +WORKDIR / +ARG DEBIAN_FRONTEND=noninteractive + +COPY common.sh lib.sh / +RUN /common.sh + +COPY cmake.sh / +RUN /cmake.sh + +COPY xargo.sh / +RUN /xargo.sh diff --git a/docker/Dockerfile.base.ubuntu b/docker/Dockerfile.base.ubuntu new file mode 100644 index 000000000..eab5f34cc --- /dev/null +++ b/docker/Dockerfile.base.ubuntu @@ -0,0 +1,11 @@ +FROM ubuntu:20.04 +ARG DEBIAN_FRONTEND=noninteractive + +COPY common.sh lib.sh / +RUN /common.sh + +COPY cmake.sh / +RUN /cmake.sh + +COPY xargo.sh / +RUN /xargo.sh diff --git a/docker/Dockerfile.i586-unknown-linux-gnu b/docker/Dockerfile.i586-unknown-linux-gnu index 2f16f508f..87155ff87 100644 --- a/docker/Dockerfile.i586-unknown-linux-gnu +++ b/docker/Dockerfile.i586-unknown-linux-gnu @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ g++-i686-linux-gnu \ libc6-dev-i386-cross diff --git a/docker/Dockerfile.i586-unknown-linux-musl b/docker/Dockerfile.i586-unknown-linux-musl index 0c58f4ec4..7f5f64e6d 100644 --- a/docker/Dockerfile.i586-unknown-linux-musl +++ b/docker/Dockerfile.i586-unknown-linux-musl @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY musl.sh / RUN /musl.sh TARGET=i586-linux-musl diff --git a/docker/Dockerfile.i686-linux-android b/docker/Dockerfile.i686-linux-android index 14e987e02..e89d5b10e 100644 --- a/docker/Dockerfile.i686-linux-android +++ b/docker/Dockerfile.i686-linux-android @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY android-ndk.sh / RUN /android-ndk.sh x86 28 ENV PATH=$PATH:/android-ndk/bin diff --git a/docker/Dockerfile.i686-pc-windows-gnu b/docker/Dockerfile.i686-pc-windows-gnu index 0d9da94c6..6082f8502 100644 --- a/docker/Dockerfile.i686-pc-windows-gnu +++ b/docker/Dockerfile.i686-pc-windows-gnu @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN dpkg --add-architecture i386 && apt-get update && \ apt-get install --assume-yes --no-install-recommends libz-mingw-w64-dev diff --git a/docker/Dockerfile.i686-unknown-freebsd b/docker/Dockerfile.i686-unknown-freebsd index b84b874aa..cf5941ef7 100644 --- a/docker/Dockerfile.i686-unknown-freebsd +++ b/docker/Dockerfile.i686-unknown-freebsd @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN echo "export ARCH=i686" > /freebsd-arch.sh COPY freebsd-common.sh / COPY freebsd.sh / diff --git a/docker/Dockerfile.i686-unknown-linux-gnu b/docker/Dockerfile.i686-unknown-linux-gnu index aa6fe57ad..6e7007a83 100644 --- a/docker/Dockerfile.i686-unknown-linux-gnu +++ b/docker/Dockerfile.i686-unknown-linux-gnu @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ g++-i686-linux-gnu \ libc6-dev-i386-cross diff --git a/docker/Dockerfile.i686-unknown-linux-musl b/docker/Dockerfile.i686-unknown-linux-musl index 373ea9f39..e7c507f91 100644 --- a/docker/Dockerfile.i686-unknown-linux-musl +++ b/docker/Dockerfile.i686-unknown-linux-musl @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY musl.sh / RUN /musl.sh TARGET=i686-linux-musl diff --git a/docker/Dockerfile.mips-unknown-linux-gnu b/docker/Dockerfile.mips-unknown-linux-gnu index 4b5f4aac9..b4887ec37 100644 --- a/docker/Dockerfile.mips-unknown-linux-gnu +++ b/docker/Dockerfile.mips-unknown-linux-gnu @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN apt-get install --assume-yes --no-install-recommends \ g++-mips-linux-gnu \ libc6-dev-mips-cross diff --git a/docker/Dockerfile.mips-unknown-linux-musl b/docker/Dockerfile.mips-unknown-linux-musl index a7c4eaaea..3a692e693 100644 --- a/docker/Dockerfile.mips-unknown-linux-musl +++ b/docker/Dockerfile.mips-unknown-linux-musl @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY qemu.sh / RUN /qemu.sh mips diff --git a/docker/Dockerfile.mips64-unknown-linux-gnuabi64 b/docker/Dockerfile.mips64-unknown-linux-gnuabi64 index 585da05ef..30837e017 100644 --- a/docker/Dockerfile.mips64-unknown-linux-gnuabi64 +++ b/docker/Dockerfile.mips64-unknown-linux-gnuabi64 @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ g++-mips64-linux-gnuabi64 \ libc6-dev-mips64-cross diff --git a/docker/Dockerfile.mips64-unknown-linux-muslabi64 b/docker/Dockerfile.mips64-unknown-linux-muslabi64 index 3e05753c8..0851e897b 100644 --- a/docker/Dockerfile.mips64-unknown-linux-muslabi64 +++ b/docker/Dockerfile.mips64-unknown-linux-muslabi64 @@ -1,13 +1,5 @@ -FROM ubuntu:20.04 - -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh +FROM ghcr.io/cross-rs/base:main-ubuntu +ARG DEBIAN_FRONTEND=noninteractive COPY qemu.sh / RUN /qemu.sh mips64 diff --git a/docker/Dockerfile.mips64el-unknown-linux-gnuabi64 b/docker/Dockerfile.mips64el-unknown-linux-gnuabi64 index eb08531f6..33a5bac61 100644 --- a/docker/Dockerfile.mips64el-unknown-linux-gnuabi64 +++ b/docker/Dockerfile.mips64el-unknown-linux-gnuabi64 @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ g++-mips64el-linux-gnuabi64 \ libc6-dev-mips64el-cross diff --git a/docker/Dockerfile.mips64el-unknown-linux-muslabi64 b/docker/Dockerfile.mips64el-unknown-linux-muslabi64 index 6b6c608af..06b55282b 100644 --- a/docker/Dockerfile.mips64el-unknown-linux-muslabi64 +++ b/docker/Dockerfile.mips64el-unknown-linux-muslabi64 @@ -1,13 +1,5 @@ -FROM ubuntu:20.04 - -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh +FROM ghcr.io/cross-rs/base:main-ubuntu +ARG DEBIAN_FRONTEND=noninteractive COPY qemu.sh / RUN /qemu.sh mips64el diff --git a/docker/Dockerfile.mipsel-unknown-linux-gnu b/docker/Dockerfile.mipsel-unknown-linux-gnu index 564610659..3aef1864e 100644 --- a/docker/Dockerfile.mipsel-unknown-linux-gnu +++ b/docker/Dockerfile.mipsel-unknown-linux-gnu @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ g++-mipsel-linux-gnu \ libc6-dev-mipsel-cross diff --git a/docker/Dockerfile.mipsel-unknown-linux-musl b/docker/Dockerfile.mipsel-unknown-linux-musl index ab34456df..d7d0cb439 100644 --- a/docker/Dockerfile.mipsel-unknown-linux-musl +++ b/docker/Dockerfile.mipsel-unknown-linux-musl @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY qemu.sh / RUN /qemu.sh mipsel diff --git a/docker/Dockerfile.powerpc-unknown-linux-gnu b/docker/Dockerfile.powerpc-unknown-linux-gnu index d0a31737c..126a0231b 100644 --- a/docker/Dockerfile.powerpc-unknown-linux-gnu +++ b/docker/Dockerfile.powerpc-unknown-linux-gnu @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ g++-powerpc-linux-gnu \ libc6-dev-powerpc-cross diff --git a/docker/Dockerfile.powerpc64-unknown-linux-gnu b/docker/Dockerfile.powerpc64-unknown-linux-gnu index ea7196813..580a341d0 100644 --- a/docker/Dockerfile.powerpc64-unknown-linux-gnu +++ b/docker/Dockerfile.powerpc64-unknown-linux-gnu @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ g++-powerpc64-linux-gnu \ libc6-dev-ppc64-cross diff --git a/docker/Dockerfile.powerpc64le-unknown-linux-gnu b/docker/Dockerfile.powerpc64le-unknown-linux-gnu index ab3eb7417..38ff8dd9a 100644 --- a/docker/Dockerfile.powerpc64le-unknown-linux-gnu +++ b/docker/Dockerfile.powerpc64le-unknown-linux-gnu @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ g++-powerpc64le-linux-gnu \ libc6-dev-ppc64el-cross diff --git a/docker/Dockerfile.riscv64gc-unknown-linux-gnu b/docker/Dockerfile.riscv64gc-unknown-linux-gnu index 215d56995..e1f98bd13 100644 --- a/docker/Dockerfile.riscv64gc-unknown-linux-gnu +++ b/docker/Dockerfile.riscv64gc-unknown-linux-gnu @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN apt-get update && apt-get install -y --no-install-recommends \ g++-riscv64-linux-gnu \ libc6-dev-riscv64-cross diff --git a/docker/Dockerfile.s390x-unknown-linux-gnu b/docker/Dockerfile.s390x-unknown-linux-gnu index 8bb2673d4..2c3040238 100644 --- a/docker/Dockerfile.s390x-unknown-linux-gnu +++ b/docker/Dockerfile.s390x-unknown-linux-gnu @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ g++-s390x-linux-gnu \ libc6-dev-s390x-cross diff --git a/docker/Dockerfile.sparc64-unknown-linux-gnu b/docker/Dockerfile.sparc64-unknown-linux-gnu index 15a6ee1c5..e6219b4d9 100644 --- a/docker/Dockerfile.sparc64-unknown-linux-gnu +++ b/docker/Dockerfile.sparc64-unknown-linux-gnu @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ g++-sparc64-linux-gnu \ libc6-dev-sparc64-cross diff --git a/docker/Dockerfile.sparcv9-sun-solaris b/docker/Dockerfile.sparcv9-sun-solaris index 4cf2701a6..031e84d80 100644 --- a/docker/Dockerfile.sparcv9-sun-solaris +++ b/docker/Dockerfile.sparcv9-sun-solaris @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY solaris.sh / RUN /solaris.sh sparcv9 diff --git a/docker/Dockerfile.thumbv6m-none-eabi b/docker/Dockerfile.thumbv6m-none-eabi index 1fab9f068..311c94133 100644 --- a/docker/Dockerfile.thumbv6m-none-eabi +++ b/docker/Dockerfile.thumbv6m-none-eabi @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY qemu.sh / RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ gcc-arm-none-eabi \ diff --git a/docker/Dockerfile.thumbv7em-none-eabi b/docker/Dockerfile.thumbv7em-none-eabi index 3ef13fcfe..1b63e8e42 100644 --- a/docker/Dockerfile.thumbv7em-none-eabi +++ b/docker/Dockerfile.thumbv7em-none-eabi @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY qemu.sh / RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ gcc-arm-none-eabi \ diff --git a/docker/Dockerfile.thumbv7em-none-eabihf b/docker/Dockerfile.thumbv7em-none-eabihf index aa773e620..825c18a83 100644 --- a/docker/Dockerfile.thumbv7em-none-eabihf +++ b/docker/Dockerfile.thumbv7em-none-eabihf @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY qemu.sh / RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ gcc-arm-none-eabi \ diff --git a/docker/Dockerfile.thumbv7m-none-eabi b/docker/Dockerfile.thumbv7m-none-eabi index 4eed8f027..e3c3189d9 100644 --- a/docker/Dockerfile.thumbv7m-none-eabi +++ b/docker/Dockerfile.thumbv7m-none-eabi @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY qemu.sh / RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ gcc-arm-none-eabi \ diff --git a/docker/Dockerfile.thumbv7neon-linux-androideabi b/docker/Dockerfile.thumbv7neon-linux-androideabi index 203392d52..d3ee329d1 100644 --- a/docker/Dockerfile.thumbv7neon-linux-androideabi +++ b/docker/Dockerfile.thumbv7neon-linux-androideabi @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY android-ndk.sh / RUN /android-ndk.sh arm 28 ENV PATH=$PATH:/android-ndk/bin diff --git a/docker/Dockerfile.thumbv7neon-unknown-linux-gnueabihf b/docker/Dockerfile.thumbv7neon-unknown-linux-gnueabihf index d9cfbd666..f3907426e 100644 --- a/docker/Dockerfile.thumbv7neon-unknown-linux-gnueabihf +++ b/docker/Dockerfile.thumbv7neon-unknown-linux-gnueabihf @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ g++-arm-linux-gnueabihf \ libc6-dev-armhf-cross diff --git a/docker/Dockerfile.wasm32-unknown-emscripten b/docker/Dockerfile.wasm32-unknown-emscripten index 2d040a7f0..8e8e211e2 100644 --- a/docker/Dockerfile.wasm32-unknown-emscripten +++ b/docker/Dockerfile.wasm32-unknown-emscripten @@ -1,16 +1,6 @@ -FROM emscripten/emsdk:3.1.14 -WORKDIR / +FROM ghcr.io/cross-rs/base:main-emscripten ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ libxml2 \ python diff --git a/docker/Dockerfile.x86_64-linux-android b/docker/Dockerfile.x86_64-linux-android index 00efc61d1..e378f7cd0 100644 --- a/docker/Dockerfile.x86_64-linux-android +++ b/docker/Dockerfile.x86_64-linux-android @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY android-ndk.sh / RUN /android-ndk.sh x86_64 28 ENV PATH=$PATH:/android-ndk/bin diff --git a/docker/Dockerfile.x86_64-pc-windows-gnu b/docker/Dockerfile.x86_64-pc-windows-gnu index d2b2f1620..068dfa641 100644 --- a/docker/Dockerfile.x86_64-pc-windows-gnu +++ b/docker/Dockerfile.x86_64-pc-windows-gnu @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN dpkg --add-architecture i386 && apt-get update && \ apt-get install --assume-yes --no-install-recommends libz-mingw-w64-dev diff --git a/docker/Dockerfile.x86_64-sun-solaris b/docker/Dockerfile.x86_64-sun-solaris index a290c31b6..29e9af212 100644 --- a/docker/Dockerfile.x86_64-sun-solaris +++ b/docker/Dockerfile.x86_64-sun-solaris @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY solaris.sh / RUN /solaris.sh x86_64 diff --git a/docker/Dockerfile.x86_64-unknown-dragonfly b/docker/Dockerfile.x86_64-unknown-dragonfly index 6a60522ca..0c12758d8 100644 --- a/docker/Dockerfile.x86_64-unknown-dragonfly +++ b/docker/Dockerfile.x86_64-unknown-dragonfly @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY dragonfly.sh / RUN /dragonfly.sh 5 diff --git a/docker/Dockerfile.x86_64-unknown-freebsd b/docker/Dockerfile.x86_64-unknown-freebsd index ed901d87f..dd94f1a01 100644 --- a/docker/Dockerfile.x86_64-unknown-freebsd +++ b/docker/Dockerfile.x86_64-unknown-freebsd @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - RUN echo "export ARCH=x86_64" > /freebsd-arch.sh COPY freebsd-common.sh / COPY freebsd.sh / diff --git a/docker/Dockerfile.x86_64-unknown-illumos b/docker/Dockerfile.x86_64-unknown-illumos index 922cf526f..b20ca0753 100644 --- a/docker/Dockerfile.x86_64-unknown-illumos +++ b/docker/Dockerfile.x86_64-unknown-illumos @@ -1,13 +1,5 @@ -FROM ubuntu:20.04 - -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh +FROM ghcr.io/cross-rs/base:main-ubuntu +ARG DEBIAN_FRONTEND=noninteractive COPY illumos.sh / RUN /illumos.sh x86_64 diff --git a/docker/Dockerfile.x86_64-unknown-linux-gnu b/docker/Dockerfile.x86_64-unknown-linux-gnu index 5e1105ef8..27235eaad 100644 --- a/docker/Dockerfile.x86_64-unknown-linux-gnu +++ b/docker/Dockerfile.x86_64-unknown-linux-gnu @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY qemu.sh / RUN /qemu.sh x86_64 softmmu diff --git a/docker/Dockerfile.x86_64-unknown-linux-gnu.centos b/docker/Dockerfile.x86_64-unknown-linux-gnu.centos index 52a8e381b..3751394a8 100644 --- a/docker/Dockerfile.x86_64-unknown-linux-gnu.centos +++ b/docker/Dockerfile.x86_64-unknown-linux-gnu.centos @@ -5,16 +5,7 @@ COPY lib.sh / COPY linux-image.sh / RUN /linux-image.sh x86_64 -FROM centos:7 - -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh +FROM ghcr.io/cross-rs/base:main-centos COPY qemu.sh / RUN /qemu.sh x86_64 softmmu diff --git a/docker/Dockerfile.x86_64-unknown-linux-musl b/docker/Dockerfile.x86_64-unknown-linux-musl index 2712be924..c6881d224 100644 --- a/docker/Dockerfile.x86_64-unknown-linux-musl +++ b/docker/Dockerfile.x86_64-unknown-linux-musl @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY musl.sh / RUN /musl.sh TARGET=x86_64-linux-musl diff --git a/docker/Dockerfile.x86_64-unknown-netbsd b/docker/Dockerfile.x86_64-unknown-netbsd index d1c89af8f..5ea42c961 100644 --- a/docker/Dockerfile.x86_64-unknown-netbsd +++ b/docker/Dockerfile.x86_64-unknown-netbsd @@ -1,15 +1,6 @@ -FROM ubuntu:20.04 +FROM ghcr.io/cross-rs/base:main-ubuntu ARG DEBIAN_FRONTEND=noninteractive -COPY common.sh lib.sh / -RUN /common.sh - -COPY cmake.sh / -RUN /cmake.sh - -COPY xargo.sh / -RUN /xargo.sh - COPY netbsd.sh / RUN /netbsd.sh diff --git a/src/docker/engine.rs b/src/docker/engine.rs index 8657e65b6..301d82800 100644 --- a/src/docker/engine.rs +++ b/src/docker/engine.rs @@ -71,6 +71,7 @@ pub struct Engine { impl Engine { pub const CROSS_CONTAINER_ENGINE_NO_BUILDKIT_ENV: &'static str = "CROSS_CONTAINER_ENGINE_NO_BUILDKIT"; + pub const CROSS_CONTAINER_ENGINE_NO_PULL_ENV: &'static str = "CROSS_CONTAINER_ENGINE_NO_PULL"; pub fn new( in_docker: Option, is_remote: Option, @@ -141,6 +142,15 @@ impl Engine { .map(|x| bool_from_envvar(&x)) .unwrap_or_default() } + + // if any of the base images do not exist in the registry, even + // if they exist locally, attempting to pull will fail + #[must_use] + pub fn should_pull() -> bool { + !env::var(Self::CROSS_CONTAINER_ENGINE_NO_PULL_ENV) + .map(|x| bool_from_envvar(&x)) + .unwrap_or_default() + } } // determine if the container engine is docker. this fixes issues with diff --git a/xtask/src/build_docker_image.rs b/xtask/src/build_docker_image.rs index c9d27d125..a6e198a44 100644 --- a/xtask/src/build_docker_image.rs +++ b/xtask/src/build_docker_image.rs @@ -218,7 +218,7 @@ pub fn build_docker_image( tags = vec![target.image_name(&repository, tag)]; } - if engine.kind.supports_pull_flag() { + if docker::Engine::should_pull() && engine.kind.supports_pull_flag() { docker_build.arg("--pull"); } if no_cache { diff --git a/xtask/src/util.rs b/xtask/src/util.rs index 05aa0cfaa..fb90737ee 100644 --- a/xtask/src/util.rs +++ b/xtask/src/util.rs @@ -302,9 +302,6 @@ pub fn read_dockerfiles(msg_info: &mut MessageInfo) -> cross::Result cross::Result<()> { - // count all the entries of FROM for our images - let mut counts = BTreeMap::new(); + use cross::shell::Verbosity; let mut msg_info = Verbosity::Verbose(2).into(); - let dockerfiles = read_dockerfiles(&mut msg_info)?; - for (path, dockerfile) in dockerfiles { - let lines: Vec<&str> = dockerfile.lines().collect(); - let index = lines - .iter() - .map(|x| x.trim()) - .position(|x| x.to_lowercase().starts_with("from")) - .ok_or_else(|| eyre::eyre!("unable to find FROM instruction for {:?}", path))?; - let tag = lines[index] - .split_whitespace() - .nth(1) - .ok_or_else(|| eyre::eyre!("invalid FROM instruction, got {}", lines[index]))?; - if let Some(value) = counts.get_mut(tag) { - *value += 1; - } else { - counts.insert(tag.to_string(), 1); - } - } - // Now, get the most common and ensure our base is correct. - let actual_base = cross::docker::UBUNTU_BASE; - let max_base = counts + let root = project_dir(&mut msg_info)?; + let docker = root.join("docker"); + let path = docker.join("Dockerfile.base.ubuntu"); + + let dockerfile = fs::read_to_string(&path)?; + let lines: Vec<&str> = dockerfile.lines().collect(); + let index = lines .iter() - .max_by(|x, y| x.1.cmp(y.1)) - .map(|(k, _)| k) - .ok_or_else(|| eyre::eyre!("have no dockerfiles"))?; + .map(|x| x.trim()) + .position(|x| x.to_lowercase().starts_with("from")) + .ok_or_else(|| eyre::eyre!("unable to find FROM instruction for {:?}", path))?; + let dockerfile_base = lines[index] + .split_whitespace() + .nth(1) + .ok_or_else(|| eyre::eyre!("invalid FROM instruction, got {}", lines[index]))?; - if actual_base != max_base { - eyre::bail!("most common base image is {max_base} but source code has {actual_base}") + let actual_base = cross::docker::UBUNTU_BASE; + if actual_base != dockerfile_base { + eyre::bail!("base image is {dockerfile_base} but source code has {actual_base}") } else { Ok(()) }