Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
JEMeyer committed Jun 2, 2024
1 parent b381abb commit 7796b66
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,12 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get UID and GID
id: ids
run: |
echo "USER_UID=$(id -u)" >> $GITHUB_ENV
echo "USER_GID=$(id -g)" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
push: true
tags: ghcr.io/${{ env.OWNER_LC }}/${{ github.event.repository.name }}:latest
build-args: |
USER_UID=${{ env.USER_UID }}
USER_GID=${{ env.USER_GID }}
USER_UID=1000
USER_GID=1000
8 changes: 1 addition & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,7 @@ ARG USER_UID=1000
ARG USER_GID=1000

# Check if the GID is already in use, if so, find an available GID
RUN if getent group $USER_GID; then \
USER_GID=$(getent group | awk -F: '{if ($3 >= 1000) print $3}' | sort -n | tail -1 | awk '{print $1+1}'); \
fi && \
if getent passwd $USER_UID; then \
USER_UID=$(getent passwd | awk -F: '{if ($3 >= 1000) print $3}' | sort -n | tail -1 | awk '{print $1+1}'); \
fi && \
addgroup -g $USER_GID $USERNAME && \
RUN addgroup -g $USER_GID $USERNAME && \
adduser --disabled-password -u $USER_UID -G $USERNAME $USERNAME && \
addgroup $USERNAME docker

Expand Down

0 comments on commit 7796b66

Please sign in to comment.