Skip to content

Commit

Permalink
util images with extended cap
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepCowProductions committed Jul 5, 2023
1 parent 1e010c1 commit 0d02112
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/ci-utilcontainer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build and Push Docker Images

on:
push:
paths:
- "utilcontainer/**/Dockerfile"
- "utilcontainer/**/*"
workflow_dispatch:

jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
utilcontainer: ${{ steps.changed_dirs.outputs.dirs }}
steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Get changed directories
id: changed_dirs
run: |
changed_dirs=$(git diff --name-only --diff-filter=d ${{ github.event.before }} ${{ github.sha }} | grep '^utilcontainer/' | awk -F/ '{print $2}' | uniq | sed 's/^/"/;s/$/",/')
changed_dirs=$(echo $changed_dirs | tr -d '\n')
echo "dirs=[ $changed_dirs ]"
echo "dirs=[$changed_dirs]" >> $GITHUB_OUTPUT
build-and-push-utilcontainer:
needs: detect-changes
if: ${{ needs.detect-changes.outputs.utilcontainer != '[]' || contains(github.event_name, 'workflow_dispatch') }}
strategy:
matrix:
image: ${{fromJson(needs.detect-changes.outputs.utilcontainer)}}
uses: ./.github/workflows/reusable-docker-build-push.yml
with:
image: ${{ matrix.image }}
folder: utilcontainer/${{ matrix.image }}

8 changes: 8 additions & 0 deletions utilcontainer/multitool/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM wbitt/network-multitool:e21fa4b

USER root

RUN setcap cap_chown,cap_fowner,cap_dac_read_search,cap_dac_override,cap_fsetid,cap_setuid,cap_setgid+ep /bin/chown
RUN setcap cap_chown,cap_fowner,cap_dac_read_search,cap_dac_override,cap_fsetid,cap_setuid,cap_setgid+ep /bin/chmod

# docker run --user 1000:100 --cap-add=CHOWN --cap-add=FOWNER --cap-add=cap_dac_override --cap-add=cap_dac_read_search --rm -it mymultitool:latest sh
3 changes: 3 additions & 0 deletions utilcontainer/multitool/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Multitool
A container with added capabilities for some selected binaries to be used in init container.
Extented from wbitt/network-multitool former pragma/network-multitool

0 comments on commit 0d02112

Please sign in to comment.