fix centos scl repo #61
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- "*" | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- distro: centos-7 | |
platform: linux/amd64 | |
- distro: bionic | |
platform: linux/amd64 | |
- distro: aarch64 | |
platform: linux/arm64 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
version: latest | |
- name: Login to ghcr | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.CR_USERNAME }} | |
password: ${{ secrets.CR_PAT }} | |
- name: Build | |
uses: docker/build-push-action@v5 | |
with: | |
file: ${{ matrix.distro }}/Dockerfile | |
context: . | |
platforms: ${{ matrix.platform }} | |
push: true | |
tags: ghcr.io/nervosnetwork/ckb-docker-builder:${{ matrix.distro }}-${{ github.sha }} | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
matrix: | |
include: | |
- distro: centos-7 | |
platform: linux/amd64 | |
- distro: bionic | |
platform: linux/amd64 | |
- distro: aarch64 | |
platform: linux/arm64 | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Checkout CKB | |
uses: actions/checkout@v2 | |
with: | |
repository: nervosnetwork/ckb | |
path: ckb | |
- if: matrix.platform == 'linux/arm64' | |
name: Build CKB on arm64 | |
run: | | |
docker run --platform ${{matrix.platform}} --rm -i -w /ckb -v $(pwd)/ckb:/ckb -e OPENSSL_STATIC=1 -e OPENSSL_LIB_DIR=/usr/local/lib -e OPENSSL_INCLUDE_DIR=/usr/local/include ghcr.io/nervosnetwork/ckb-docker-builder:${{ matrix.distro }}-${{ github.sha }} make prod | |
- if: matrix.platform == 'linux/amd64' | |
name: Build CKB on amd64 | |
run: | | |
docker run --platform ${{matrix.platform}} --rm -i -w /ckb -v $(pwd)/ckb:/ckb -e OPENSSL_STATIC=1 -e OPENSSL_LIB_DIR=/usr/local/lib64 -e OPENSSL_INCLUDE_DIR=/usr/local/include ghcr.io/nervosnetwork/ckb-docker-builder:${{ matrix.distro }}-${{ github.sha }} make prod | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
needs: test | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
strategy: | |
matrix: | |
include: | |
- distro: centos-7 | |
platform: linux/amd64 | |
- distro: bionic | |
platform: linux/amd64 | |
- distro: aarch64 | |
platform: linux/arm64 | |
steps: | |
- name: Login to ghcr | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.CR_USERNAME }} | |
password: ${{ secrets.CR_PAT }} | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Determine tag | |
id: tag | |
run: echo "::set-output name=tag::${GITHUB_REF##*/}" | |
- name: Tag and push image | |
run: | | |
SRC_TAG=ghcr.io/nervosnetwork/ckb-docker-builder:${{ matrix.distro }}-${{ github.sha }} | |
docker pull --platform ${{matrix.platform}} "$SRC_TAG" | |
docker tag "$SRC_TAG" ghcr.io/nervosnetwork/ckb-docker-builder:${{ matrix.distro }}-latest | |
docker push ghcr.io/nervosnetwork/ckb-docker-builder:${{ matrix.distro }}-latest | |
docker tag "$SRC_TAG" ghcr.io/nervosnetwork/ckb-docker-builder:${{ matrix.distro }}-${{ steps.tag.outputs.tag }} | |
docker push ghcr.io/nervosnetwork/ckb-docker-builder:${{ matrix.distro }}-${{ steps.tag.outputs.tag }} | |
docker tag "$SRC_TAG" nervos/ckb-docker-builder:${{ matrix.distro }}-latest | |
docker push nervos/ckb-docker-builder:${{ matrix.distro }}-latest | |
docker tag "$SRC_TAG" nervos/ckb-docker-builder:${{ matrix.distro }}-${{ steps.tag.outputs.tag }} | |
docker push nervos/ckb-docker-builder:${{ matrix.distro }}-${{ steps.tag.outputs.tag }} |