-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
180 additions
and
134 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
name: Docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- "*" | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
distro: [centos-7, bionic] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up docker buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
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@v2 | ||
with: | ||
file: ${{ matrix.distro }}/Dockerfile | ||
context: . | ||
push: true | ||
tags: ghcr.io/nervosnetwork/ckb-docker-builder:${{ matrix.distro }}-${{ github.sha }} | ||
|
||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
needs: build | ||
|
||
strategy: | ||
matrix: | ||
distro: [centos-7, bionic] | ||
|
||
steps: | ||
- name: Checkout CKB | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: nervosnetwork/ckb | ||
path: ckb | ||
|
||
- name: Build CKB | ||
run: | | ||
docker run --rm -i -w /ckb -v $(pwd)/ckb:/ckb 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: | ||
distro: [centos-7, bionic] | ||
|
||
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 | ||
uses: akhilerm/[email protected] | ||
with: | ||
src: ghcr.io/nervosnetwork/ckb-docker-builder:${{ matrix.distro }}-${{ github.sha }} | ||
dst: | | ||
ghcr.io/nervosnetwork/ckb-docker-builder:${{ matrix.distro }}-latest | ||
ghcr.io/nervosnetwork/ckb-docker-builder:${{ matrix.distro }}-${{ steps.tag.outputs.tag }} | ||
nervos/ckb-docker-builder:${{ matrix.distro }}-latest | ||
nervos/ckb-docker-builder:${{ matrix.distro }}-${{ github.event.inputs.tag }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Template Test | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- "*" | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: python3 gen-dockerfiles | ||
- run: git diff --exit-code | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/ckb |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
DOCKERHUB_REPO := nervos/ckb-docker-builder | ||
GHCR_REPO := ghcr.io/nervosnetwork/ckb-docker-builder | ||
IMAGE_VERSION := rust-$(shell sed -n "s/RUST_VERSION = '\(.*\)'$$/\1/p" gen-dockerfiles) | ||
|
||
bionic/Dockerfile: gen-dockerfiles templates/bionic.Dockerfile | ||
python3 gen-dockerfiles | ||
|
||
centos-7/Dockerfile: gen-dockerfiles templates/centos-7.Dockerfile | ||
python3 gen-dockerfiles | ||
|
||
build-all: build-bionic build-centos-7 | ||
|
||
build-bionic: bionic/Dockerfile | ||
docker build -f bionic/Dockerfile --tag ${DOCKERHUB_REPO}:bionic-${IMAGE_VERSION} . | ||
|
||
build-centos-7: centos-7/Dockerfile | ||
docker build -f centos-7/Dockerfile --tag ${DOCKERHUB_REPO}:centos-7-${IMAGE_VERSION} . | ||
|
||
.PHONY: build-all build-bionic build-centos-7 | ||
|
||
push-all: push-bionic push-centos-7 | ||
|
||
push-bionic: build-bionic | ||
docker push ${DOCKERHUB_REPO}:bionic-${IMAGE_VERSION} | ||
|
||
push-centos-7: build-centos-7 | ||
docker push ${DOCKERHUB_REPO}:centos-7-${IMAGE_VERSION} | ||
|
||
.PHONY: push-all push-bionic push-centos-7 | ||
|
||
test-all: test-bionic test-centos-7 | ||
|
||
sync-ckb: | ||
if [ -d ckb ]; then git -C ckb pull; else git clone --depth 1 https://github.com/nervosnetwork/ckb.git; fi | ||
|
||
test-bionic: sync-ckb | ||
docker --rm -it -w /ckb -v "$$(pwd)/ckb:/ckb" ${DOCKERHUB_REPO}:bionic-${IMAGE_VERSION} make prod | ||
|
||
test-centos-7: sync-ckb | ||
docker --rm -it -w /ckb -v "$$(pwd)/ckb:/ckb" ${DOCKERHUB_REPO}:centos-7-${IMAGE_VERSION} make prod | ||
|
||
.PHONY: test-all test-bionic test-centos-7 sync-ckb |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
scl enable devtoolset-7 "$*" |
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
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.