Skip to content

Commit 435c387

Browse files
committed
feat: run container as non-root
- also update gha setup to reflect this change - differentiate between build and test of the container Signed-off-by: Robert Waffen <[email protected]>
1 parent 60bd6ff commit 435c387

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ jobs:
3434
- name: Checkout repository
3535
uses: actions/checkout@v4
3636

37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@v3
39+
3740
- name: Build image
3841
uses: docker/build-push-action@v6
3942
with:
@@ -51,6 +54,29 @@ jobs:
5154
RUBYGEM_MODULESYNC=${{ matrix.rubygem_modulesync }}
5255
RUBYGEM_BUNDLER=${{ matrix.rubygem_bundler }}
5356
57+
test_ci_container:
58+
name: 'Test CI container'
59+
runs-on: ubuntu-latest
60+
needs:
61+
- setup-matrix
62+
- build_test_container
63+
strategy:
64+
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
65+
steps:
66+
- name: Set up Docker Buildx
67+
uses: docker/setup-buildx-action@v3
68+
69+
- name: Download artifact
70+
uses: actions/download-artifact@v4
71+
with:
72+
name: voxbox-${{ matrix.rubygem_puppet }}_${{ github.sha }}
73+
path: /tmp
74+
75+
- name: Load Docker image
76+
run: |
77+
docker load --input /tmp/voxbox-${{ matrix.rubygem_puppet }}_${{ github.sha }}.tar
78+
docker image ls -a
79+
5480
- name: Clone voxpupuli/puppet-example repository
5581
uses: actions/checkout@v4
5682
with:
@@ -71,6 +97,7 @@ jobs:
7197
tests:
7298
needs:
7399
- build_test_container
100+
- test_ci_container
74101
runs-on: ubuntu-latest
75102
name: Test suite
76103
steps:

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,8 @@ RUN apk update \
7373

7474
WORKDIR /repo
7575

76+
RUN addgroup -S voxbox && adduser -S voxbox -G voxbox
77+
USER voxbox
78+
7679
ENTRYPOINT [ "rake" ]
7780
CMD [ "-f", "/Rakefile", "-T" ]

0 commit comments

Comments
 (0)