Skip to content

Commit

Permalink
Refactor Dockerfiles into base images.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexhuszagh committed Sep 30, 2022
1 parent 5261b6a commit b74a1bd
Show file tree
Hide file tree
Showing 59 changed files with 196 additions and 574 deletions.
89 changes: 88 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,97 @@ jobs:
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
COMMIT_AUTHOR: ${{ github.event.head_commit.author.username }}

build-base:
name: base (${{ matrix.image }})
runs-on: ubuntu-latest
needs: [shellcheck, test, check]
if: github.event_name == 'push'
strategy:
fail-fast: false
matrix:
image:
- ubuntu
- centos
- emscripten
outputs:
images: ${{ steps.build-docker-image.outputs.images && fromJSON(steps.build-docker-image.outputs.images) }}
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}"
env:
IMAGE: ${{ matrix.image }}
shell: bash

- name: LLVM instrument coverage
uses: ./.github/actions/cargo-llvm-cov
with:
name: cross-${{matrix.image}}

- 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) }}
- name: Build Docker image
id: build-docker-image
timeout-minutes: 60
run: cargo xtask build-docker-image -v "${IMAGE}"
env:
IMAGE: ${{ matrix.image }}
LABELS: ${{ steps.docker-meta.outputs.labels }}
LATEST: ${{ needs.check.outputs.is-latest || 'false' }}
shell: bash

- uses: ./.github/actions/cargo-install-upload-artifacts
if: matrix.deploy
with:
target: ${{ matrix.image }}
image: ${{ steps.build-docker-image.outputs.image }}

- 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 --push "${IMAGE}"
env:
IMAGE: ${{ matrix.target }}
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'
strategy:
fail-fast: false
Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.aarch64-linux-android
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/ubuntu:main
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
Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.aarch64-unknown-linux-gnu
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/ubuntu:main
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
Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.aarch64-unknown-linux-musl
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/ubuntu:main
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

Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.arm-linux-androideabi
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/ubuntu:main
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
Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.arm-unknown-linux-gnueabi
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/ubuntu:main
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
Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.arm-unknown-linux-gnueabihf
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/ubuntu:main
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 /
Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.arm-unknown-linux-musleabi
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/ubuntu:main
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

Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.arm-unknown-linux-musleabihf
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/ubuntu:main
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

Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.armv5te-unknown-linux-gnueabi
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/ubuntu:main
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 \
Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.armv5te-unknown-linux-musleabi
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/ubuntu:main
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

Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.armv7-linux-androideabi
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/ubuntu:main
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
Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.armv7-unknown-linux-gnueabi
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/ubuntu:main
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
Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.armv7-unknown-linux-gnueabihf
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/ubuntu:main
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
Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.armv7-unknown-linux-musleabi
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/ubuntu:main
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

Expand Down
11 changes: 1 addition & 10 deletions docker/Dockerfile.armv7-unknown-linux-musleabihf
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/ubuntu:main
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

Expand Down
10 changes: 10 additions & 0 deletions docker/Dockerfile.centos
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions docker/Dockerfile.emscripten
Original file line number Diff line number Diff line change
@@ -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
11 changes: 1 addition & 10 deletions docker/Dockerfile.i586-unknown-linux-gnu
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
FROM ubuntu:20.04
FROM ghcr.io/cross-rs/ubuntu:main
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
Expand Down
Loading

0 comments on commit b74a1bd

Please sign in to comment.