From cc321c41f03dfa5b754110e969ad61c793533e71 Mon Sep 17 00:00:00 2001 From: topahadzi Date: Fri, 27 Oct 2023 15:14:49 +0700 Subject: [PATCH] push docker --- .github/workflows/docker.yaml | 57 +++++++++++++++++++++++++++++++++++ Dockerfile | 8 +++++ cosign.pub | 4 +++ 3 files changed, 69 insertions(+) create mode 100644 .github/workflows/docker.yaml create mode 100644 Dockerfile create mode 100644 cosign.pub diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml new file mode 100644 index 0000000..e4fd366 --- /dev/null +++ b/.github/workflows/docker.yaml @@ -0,0 +1,57 @@ +name: docker + +on: + push: + tags: + - "v*" + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository_owner }}/litmus-node-fault + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - id: docker_meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + + - id: docker_build + name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + platforms: linux/amd64 + push: true + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} + + - name: Install Cosign + uses: sigstore/cosign-installer@main + + - name: Sign image with a key + run: | + cosign sign --key env://COSIGN_PRIVATE_KEY ${IMAGE_NAME,,}@${IMAGE_DIGEST} --yes + env: + IMAGE_NAME: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + IMAGE_DIGEST: ${{ steps.docker_build.outputs.digest }} + COSIGN_PRIVATE_KEY: ${{secrets.COSIGN_PRIVATE_KEY}} + COSIGN_PASSWORD: ${{secrets.COSIGN_PASSWORD}} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9205eba --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM alpine:latest + +RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" +RUN chmod +x kubectl +RUN mv ./kubectl /usr/local/bin/ +RUN curl -LO https://github.com/kvaps/kubectl-node-shell/raw/master/kubectl-node_shell +RUN chmod +x ./kubectl-node_shell +RUN mv ./kubectl-node_shell /usr/local/bin/kubectl-node_shell \ No newline at end of file diff --git a/cosign.pub b/cosign.pub new file mode 100644 index 0000000..a1fac4f --- /dev/null +++ b/cosign.pub @@ -0,0 +1,4 @@ +-----BEGIN PUBLIC KEY----- +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEecYo6AqKFTb9su1Kcodys3hvO+Fl +3R/vJCyD8/aQR39T+251p/4qCAsjsb4EJ/fWD5rbnilgBCbTIyIARVz7jQ== +-----END PUBLIC KEY-----