Skip to content

Commit 5cbf19a

Browse files
committed
Build with GitHub actions; multi-arch Docker image
1 parent 3b3665d commit 5cbf19a

File tree

4 files changed

+90
-2
lines changed

4 files changed

+90
-2
lines changed

.github/workflows/build.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: DockerHub
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
tags:
8+
- '*'
9+
10+
jobs:
11+
12+
build:
13+
14+
runs-on: ubuntu-18.04
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- name: Get util-linux version
20+
id: get_util_linux
21+
run: |
22+
version=$(curl --silent https://api.github.com/repos/karelzak/util-linux/tags | jq -r '.[0].name' | sed -e 's/^v//')
23+
echo "::debug::get util-linux version ${version}"
24+
echo "::set-output name=version::${version}"
25+
26+
- name: Set up QEMU
27+
uses: docker/setup-qemu-action@v1
28+
29+
- name: Set up Docker buildx
30+
uses: docker/setup-buildx-action@v1
31+
32+
- name: Login to DockerHub
33+
uses: docker/login-action@v1
34+
with:
35+
username: ${{ secrets.DOCKER_USERNAME }}
36+
password: ${{ secrets.DOCKER_TOKEN }}
37+
38+
- name: Build and push Docker image
39+
id: docker_build
40+
uses: docker/build-push-action@v2
41+
with:
42+
build-args: UTIL_LINUX_VER=${{ steps.get_util_linux.outputs.version }}
43+
platforms: linux/amd64,linux/arm64
44+
tags: |
45+
${{ secrets.DOCKER_USERNAME }}/nsenter:${{ steps.get_util_linux.outputs.version }}
46+
${{ secrets.DOCKER_USERNAME }}/nsenter:latest
47+
push: true
48+
49+
- name: Image digest
50+
run: echo ${{ steps.docker_build.outputs.digest }}
51+
52+

.github/workflows/cron.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Tag on Util-Linux Release
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
#- cron: "*/5 * * * *" uncomment for debug (every 5 min)
7+
8+
jobs:
9+
check_release:
10+
11+
runs-on: ubuntu-18.04
12+
13+
steps:
14+
- name: Get latest repository tag
15+
id: get_latest_tag
16+
run: |
17+
tag=$(curl --silent https://api.github.com/repos/${GITHUB_REPOSITORY}/git/refs/tags | jq -r '.[-1].ref' | awk -F/ '{print $NF}')
18+
echo "::debug::git repository tag ${tag}"
19+
echo "::set-output name=tag::${tag}"
20+
21+
- name: Get util-linux version
22+
id: get_util_linux
23+
run: |
24+
version=$(curl --silent https://api.github.com/repos/karelzak/util-linux/tags | jq -r '.[0].name' | sed -e 's/^v//')
25+
echo "::debug::get util-linux version ${version}"
26+
echo "::set-output name=version::${version}"
27+
28+
- name: Tag repository with latest util-linux version, if needed
29+
id: tag_repository
30+
if: steps.get_latest_tag.outputs.tag != steps.get_util_linux.outputs.version
31+
uses: tvdias/github-tagger@v0.0.1
32+
with:
33+
repo-token: ${{ secrets.CR_PAT }}
34+
tag: ${{steps.get_util_linux.outputs.version}}
35+
36+

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ RUN apt-get update && apt-get install -yq make gcc gettext autopoint bison libto
66
WORKDIR /code
77

88
# download util-linux sources
9-
ENV UTIL_LINUX_VER=2.34
9+
ARG UTIL_LINUX_VER
1010
ADD https://github.com/karelzak/util-linux/archive/v${UTIL_LINUX_VER}.tar.gz .
1111
RUN tar -xf v${UTIL_LINUX_VER}.tar.gz && mv util-linux-${UTIL_LINUX_VER} util-linux
1212

nsenter-node.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ kubectl run ${podName:?} --restart=Never -it --rm --image overriden --overrides
1818
"containers": [
1919
{
2020
"name": "nsenter",
21-
"image": "alexeiled/nsenter:2.34",
21+
"image": "alexeiled/nsenter",
2222
"command": [
2323
"/nsenter", "--all", "--target=1", "--", "su", "-"
2424
],

0 commit comments

Comments
 (0)