diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 00000000..58b9d110 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,85 @@ +name: Image Build + +on: + push: + branches: + - '**' + tags: + - 'v*.*.*' + pull_request: + branches: + - 'master' + +jobs: + Build: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Docker meta for KubeSphere + id: meta + if: github.repository_owner == 'kubesphere' + uses: docker/metadata-action@v3 + with: + images: | + kubespheredev/s2irun + ghcr.io/${{ github.repository_owner }}/s2irun + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + - name: Docker meta for Contributors + id: metaContributors + if: github.repository_owner != 'kubesphere' + uses: docker/metadata-action@v3 + with: + images: | + ghcr.io/${{ github.repository_owner }}/s2irun + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_SECRETS }} + - name: Login to GHCR + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GHCR_TOKEN }} + - name: Build and push Docker images + uses: docker/build-push-action@v2.4.0 + if: github.repository_owner == 'kubesphere' + with: + context: . + file: Dockerfile + tags: ${{ steps.meta.outputs.tags }} + push: ${{ github.event_name != 'pull_request' }} + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64 + - name: Build and push Docker images for Contributors + uses: docker/build-push-action@v2.4.0 + if: github.repository_owner != 'kubesphere' + with: + context: . + file: Dockerfile + tags: ${{ steps.metaContributors.outputs.tags }} + push: ${{ github.event_name != 'pull_request' }} + labels: ${{ steps.metaContributors.outputs.labels }} + platforms: linux/amd64,linux/arm64 diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile new file mode 100644 index 00000000..805e4568 --- /dev/null +++ b/.gitpod.Dockerfile @@ -0,0 +1,6 @@ +FROM gitpod/workspace-full + +# More information: https://www.gitpod.io/docs/config-docker/ +RUN sudo rm -rf /usr/bin/hd && \ + brew install linuxsuren/linuxsuren/hd && \ + hd install cli/cli diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 00000000..5dcbc12c --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,9 @@ +image: + file: .gitpod.Dockerfile + +tasks: + - init: | + git config --global user.name $GIT_AUTHOR_NAME + git config --global user.email $GIT_COMMITTER_EMAIL + echo Yes | gh repo fork + make image diff --git a/README.md b/README.md index 508b6b16..62e2a5a5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ ## S2IRun - +[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/kubesphere/s2irun) [![License](http://img.shields.io/badge/license-apache%20v2-blue.svg)](https://github.com/KubeSphere/s2irun/blob/master/LICENSE) [![Go Report Card](https://goreportcard.com/badge/github.com/kubesphere/s2ioperator)](https://goreportcard.com/report/github.com/kubesphere/s2irun) [![S2IRun release](https://img.shields.io/github/release/kubesphere/s2irun.svg?color=release&label=release&logo=release&logoColor=release)](https://github.com/kubesphere/s2irun/releases/tag/v0.0.3) +![Docker Pulls](https://img.shields.io/docker/pulls/kubesphere/s2irun) Source to image is a command toolkit and workflow for building reproducible container images from source code. S2IRun is the instance that executes the s2i build process, and can be containerized so that it can run in any container environment. S2IRun produces ready-to-run images by injecting source code into a container image and letting the container prepare that source code for execution.