Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting the UID and GID of clamav at runtime #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions clamav/1.0/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ RUN apk update && apk upgrade \
# For building static libraries with Mussels
git \
patchelf \
shadow \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem like this needs to be added to the first image (the "builder" image) as the entrypoint script is based on the second image.

&& \
python3 -m pip install --upgrade pip && \
python3 -m pip install mussels && \
Expand Down
9 changes: 9 additions & 0 deletions clamav/1.0/alpine/scripts/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@

set -eu

# update userid/groupid if specified
if [ -n $CLAMAV_UID ]; then
usermod -u $CLAMAV_UID clamav
fi

if [ -n $CLAMAV_GID ]; then
groupmod -g $CLAMAV_GID clamav
fi

if [ ! -d "/run/clamav" ]; then
install -d -g "clamav" -m 775 -o "clamav" "/run/clamav"
fi
Expand Down
1 change: 1 addition & 0 deletions clamav/1.0/debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ RUN apt update && apt install -y \
libxml2-dev \
zlib1g-dev \
curl \
shadow \
&& \
rm -rf /var/cache/apt/archives \
&& \
Expand Down
9 changes: 9 additions & 0 deletions clamav/1.0/debian/scripts/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@

set -eu

# update userid/groupid if specified
if [ -n $CLAMAV_UID ]; then
usermod -u $CLAMAV_UID clamav
fi

if [ -n $CLAMAV_GID ]; then
groupmod -g $CLAMAV_GID clamav
fi

if [ ! -d "/run/clamav" ]; then
install -d -g "clamav" -m 775 -o "clamav" "/run/clamav"
fi
Expand Down