diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0e50163..13f1c0e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,4 +1,4 @@ -name: DockerHub +name: Build docker image on: push: @@ -29,18 +29,12 @@ jobs: - name: Set up Docker buildx uses: docker/setup-buildx-action@v1 - - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_TOKEN }} - name: Login to GitHub Container Registry uses: docker/login-action@v1 with: registry: ghcr.io - username: ${{ github.repository_owner }} + username: bitprocessor password: ${{ secrets.CR_PAT }} - name: Build and push Docker image @@ -50,10 +44,7 @@ jobs: build-args: UTIL_LINUX_VER=${{ steps.get_util_linux.outputs.version }} platforms: linux/amd64,linux/arm64 tags: | - ${{ secrets.DOCKER_USERNAME }}/nsenter:${{ steps.get_util_linux.outputs.version }} - ${{ secrets.DOCKER_USERNAME }}/nsenter:latest - ghcr.io/${{ github.repository_owner }}/nsenter:${{ steps.get_util_linux.outputs.version }} - ghcr.io/${{ github.repository_owner }}/nsenter:latest + ghcr.io/bitprocessor/nsenter:latest push: true - name: Image digest diff --git a/.github/workflows/cron.yaml b/.github/workflows/cron.yaml deleted file mode 100644 index 96b4b62..0000000 --- a/.github/workflows/cron.yaml +++ /dev/null @@ -1,36 +0,0 @@ -name: Tag on Util-Linux Release - -on: - schedule: - - cron: "0 0 * * *" - #- cron: "*/5 * * * *" uncomment for debug (every 5 min) - -jobs: - check_release: - - runs-on: ubuntu-18.04 - - steps: - - name: Get latest repository tag - id: get_latest_tag - run: | - tag=$(curl --silent https://api.github.com/repos/${GITHUB_REPOSITORY}/git/refs/tags | jq -r '.[-1].ref' | awk -F/ '{print $NF}') - echo "::debug::git repository tag ${tag}" - echo "::set-output name=tag::${tag}" - - - name: Get util-linux version - id: get_util_linux - run: | - version=$(curl --silent https://api.github.com/repos/karelzak/util-linux/tags | jq -r '.[0].name' | sed -e 's/^v//') - echo "::debug::get util-linux version ${version}" - echo "::set-output name=version::${version}" - - - name: Tag repository with latest util-linux version, if needed - id: tag_repository - if: steps.get_latest_tag.outputs.tag != steps.get_util_linux.outputs.version - uses: tvdias/github-tagger@v0.0.1 - with: - repo-token: ${{ secrets.CR_PAT }} - tag: ${{steps.get_util_linux.outputs.version}} - - diff --git a/Dockerfile b/Dockerfile index 3b056aa..9dd9e53 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ RUN make LDFLAGS="--static" nsenter # Final image FROM scratch - +LABEL org.opencontainers.image.source https://github.com/BitProcessor/nsenter COPY --from=builder /code/util-linux/nsenter / ENTRYPOINT ["/nsenter"] diff --git a/README.md b/README.md index 24f7bb0..d85eca2 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,23 @@ -![DockerHub](https://github.com/alexei-led/nsenter/workflows/DockerHub/badge.svg) ![Docker Pulls](https://img.shields.io/docker/pulls/alexeiled/nsenter.svg?style=popout) [![](https://images.microbadger.com/badges/image/alexeiled/nsenter.svg)](https://microbadger.com/images/alexeiled/nsenter "Get your own image badge on microbadger.com") - # nsenter -## Info - -`alexeiled/nsenter` Docker image is a `scratch` image that contains only one statically linked `nsenter` file. - ## Usage Read the official `nsenter` [documentation](http://man7.org/linux/man-pages/man1/nsenter.1.html). -## Continuously Updated with GitHub Actions - -The `nsenter` is automatically updated when a new version of [util-linux](https://github.com/karelzak/util-linux) is released. - -## How do I *use* `alexeiled/nsenter`? +## How do I *use* `ghcr.io/bitprocessor/nsenter`? Enter the container: ```sh # enter all namespaces of selected container -docker run -it --rm --privileged --pid=container: alexeiled/nsenter --all --target 1 -- su - +docker run -it --rm --privileged --pid=container: ghcr.io/bitprocessor/nsenter --all --target 1 -- su - ``` Enter the Docker host: ```sh # enter all namespaces of Docker host -docker run -it --rm --privileged --pid=host alexeiled/nsenter --all --target 1 -- su - +docker run -it --rm --privileged --pid=host ghcr.io/bitprocessor/nsenter --all --target 1 -- su - ``` ## Enter Kubernetes node diff --git a/nsenter-node.sh b/nsenter-node.sh index 7507224..4908d80 100755 --- a/nsenter-node.sh +++ b/nsenter-node.sh @@ -24,9 +24,9 @@ kubectl run ${podName:?} --restart=Never -it --rm --image overriden --overrides "containers": [ { "name": "nsenter", - "image": "alexeiled/nsenter", + "image": "ghcr.io/bitprocessor/nsenter:latest", "command": [ - "/nsenter", "--all", "--target=1", "--", "su", "-" + "/nsenter", "-m", "-u", "-i", "-n", "-p", "-C", "-r", "-w", "--target=1", "--", "su", "-" ], "stdin": true, "tty": true,