Skip to content

Commit

Permalink
feat: add root user Docker generation
Browse files Browse the repository at this point in the history
  • Loading branch information
yinzara committed Aug 18, 2023
1 parent 0346619 commit ec2293a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
17 changes: 16 additions & 1 deletion .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ jobs:

- name: Set extra tags if needed
if: ${{ github.event_name != 'pull_request' && matrix.context.dockerfile == 'Dockerfile' }}
run: echo EXTRA_TAGS="-t ${{ env.REPOSITORY }}:${{ env.VERSION }} -t ${{ env.REPOSITORY }}:latest-${{ matrix.context.os }} -t ${{ env.REPOSITORY }}:latest" >> $GITHUB_ENV
run: |
echo EXTRA_TAGS="-t ${{ env.REPOSITORY }}:${{ env.VERSION }} -t ${{ env.REPOSITORY }}:latest-${{ matrix.context.os }} -t ${{ env.REPOSITORY }}:latest" >> $GITHUB_ENV
echo EXTRA_ROOT_TAGS="-t ${{ env.REPOSITORY }}:${{ env.VERSION }}-root -t ${{ env.REPOSITORY }}:latest-${{ matrix.context.os }}-root -t ${{ env.REPOSITORY }}:latest-root" >> $GITHUB_ENV
- name: Build the Docker image
run: >
Expand All @@ -78,3 +80,16 @@ jobs:
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
--build-arg VERSION=${{ env.VERSION }}
--build-arg VCS_REF=${{ github.sha }}
- name: Build the root Docker image
run: >
docker buildx build . ${PUSH_ARG} --no-cache
--platform ${{ matrix.context.platforms }}
-f Dockerfile.root
-t ${{ env.REPOSITORY }}:${{ env.VERSION }}-${{ matrix.context.node }}-root
-t ${{ env.REPOSITORY }}:${{ env.VERSION }}-${{ matrix.context.node }}-${{ matrix.context.os }}-root
-t ${{ env.REPOSITORY }}:latest-${{ matrix.context.node }}-root
-t ${{ env.REPOSITORY }}:latest-${{ matrix.context.node }}-${{ matrix.context.os }}-root
${EXTRA_ROOT_TAGS}
--build-arg FROM=${{ env.REPOSITORY }}:${{ env.VERSION }}-${{ matrix.context.node }}-${{ matrix.context.os }}
3 changes: 3 additions & 0 deletions Dockerfile.root
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ARG FROM
FROM ${FROM}
USER root

0 comments on commit ec2293a

Please sign in to comment.