Skip to content

Commit

Permalink
feat: run container as non-root
Browse files Browse the repository at this point in the history
- also update gha setup to reflect this change
- differentiate between build and test of the container

Signed-off-by: Robert Waffen <[email protected]>
  • Loading branch information
rwaffen committed Sep 27, 2024
1 parent 60bd6ff commit 435c387
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build image
uses: docker/build-push-action@v6
with:
Expand All @@ -51,6 +54,29 @@ jobs:
RUBYGEM_MODULESYNC=${{ matrix.rubygem_modulesync }}
RUBYGEM_BUNDLER=${{ matrix.rubygem_bundler }}
test_ci_container:
name: 'Test CI container'
runs-on: ubuntu-latest
needs:
- setup-matrix
- build_test_container
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Download artifact
uses: actions/download-artifact@v4
with:
name: voxbox-${{ matrix.rubygem_puppet }}_${{ github.sha }}
path: /tmp

- name: Load Docker image
run: |
docker load --input /tmp/voxbox-${{ matrix.rubygem_puppet }}_${{ github.sha }}.tar
docker image ls -a
- name: Clone voxpupuli/puppet-example repository
uses: actions/checkout@v4
with:
Expand All @@ -71,6 +97,7 @@ jobs:
tests:
needs:
- build_test_container
- test_ci_container
runs-on: ubuntu-latest
name: Test suite
steps:
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,8 @@ RUN apk update \

WORKDIR /repo

RUN addgroup -S voxbox && adduser -S voxbox -G voxbox
USER voxbox

ENTRYPOINT [ "rake" ]
CMD [ "-f", "/Rakefile", "-T" ]

0 comments on commit 435c387

Please sign in to comment.